build: update Dockerfile

This commit is contained in:
Rob Watson 2024-11-20 20:36:36 +01:00
parent a9caca2772
commit 881f37f89c
2 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,5 @@
FROM golang:1.23-alpine3.20 as go-builder FROM golang:1.23-alpine3.20 AS go-builder
ENV GOPATH "" ENV GOPATH=""
RUN apk add git RUN apk add git
@ -9,8 +9,24 @@ RUN go mod download
ADD ./ . ADD ./ .
RUN go build -o ./server . RUN go build -o ./server .
FROM hugomods/hugo:latest AS blog-builder
WORKDIR /app
RUN apk update && \
apk add git && \
git clone https://git.netflux.io/rob/netflux-blog blog && \
cd blog && \
git submodule update --init --recursive && \
hugo
FROM alpine:3.14 FROM alpine:3.14
COPY --from=go-builder /app/server /app/server COPY --from=go-builder /app/server /app/server
COPY --from=blog-builder /app/blog/public /www/html
ENV NETFLUX_ROOT_PATH=/www/html
ENTRYPOINT ["/app/server"] ENTRYPOINT ["/app/server"]

4
Makefile Normal file
View File

@ -0,0 +1,4 @@
.PHONY: deploy
deploy: # build and deploy the latest version of the image.
docker build -t netfluxio/homepage:latest .
docker push netfluxio/homepage:latest