From 881f37f89c94a369960ce85c5946a09c4d15485d Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 20 Nov 2024 20:36:36 +0100 Subject: [PATCH] build: update Dockerfile --- Dockerfile | 20 ++++++++++++++++++-- Makefile | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile index e9c5714..b484bc2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM golang:1.23-alpine3.20 as go-builder -ENV GOPATH "" +FROM golang:1.23-alpine3.20 AS go-builder +ENV GOPATH="" RUN apk add git @@ -9,8 +9,24 @@ RUN go mod download ADD ./ . 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 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"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5f38f99 --- /dev/null +++ b/Makefile @@ -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