From 64d1a2f5364aa2e8856752dacef5adff419c7bb5 Mon Sep 17 00:00:00 2001 From: d4rklynk Date: Sat, 18 Nov 2023 14:18:39 +0100 Subject: [PATCH 1/3] Update Dockerfile --- Dockerfile | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 44bf954..bd7cbe2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,15 @@ # Build image -FROM golang:1.19-alpine as build +# SHA256 of golang:1.21-alpine3.18 linux/amd64 +FROM golang@sha256:f475434ea2047a83e9ba02a1da8efc250fa6b2ed0e9e8e4eb8c5322ea6997795 as build -LABEL org.opencontainers.image.source=https://github.com/writefreely/writefreely +LABEL org.opencontainers.image.source="https://github.com/writefreely/writefreely" LABEL org.opencontainers.image.description="WriteFreely is a clean, minimalist publishing platform made for writers. Start a blog, share knowledge within your organization, or build a community around the shared act of writing." -RUN apk add --update nodejs npm make g++ git -RUN npm install -g less less-plugin-clean-css +RUN apk -U upgrade \ + && apk add --no-cache nodejs npm make g++ git \ + && npm install -g less less-plugin-clean-css \ + && mkdir -p /go/src/github.com/writefreely/writefreely -RUN mkdir -p /go/src/github.com/writefreely/writefreely WORKDIR /go/src/github.com/writefreely/writefreely COPY . . @@ -18,9 +20,9 @@ ENV GO111MODULE=on ENV NODE_OPTIONS=--openssl-legacy-provider RUN make build \ - && make ui -RUN mkdir /stage && \ - cp -R /go/bin \ + && make ui \ + && mkdir /stage \ + && cp -R /go/bin \ /go/src/github.com/writefreely/writefreely/templates \ /go/src/github.com/writefreely/writefreely/static \ /go/src/github.com/writefreely/writefreely/pages \ @@ -29,9 +31,12 @@ RUN mkdir /stage && \ /stage # Final image -FROM alpine:3 +# SHA256 of alpine:3.18.4 linux/amd64 +FROM alpine@sha256:48d9183eb12a05c99bcc0bf44a003607b8e941e1d4f41f9ad12bdcc4b5672f86 + +RUN apk -U upgrade \ + && apk add --no-cache openssl ca-certificates -RUN apk add --no-cache openssl ca-certificates COPY --from=build --chown=daemon:daemon /stage /go WORKDIR /go @@ -40,3 +45,6 @@ EXPOSE 8080 USER daemon ENTRYPOINT ["cmd/writefreely/writefreely"] + +HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \ + CMD curl -fSs http://localhost:8008/health || exit 1 \ No newline at end of file From 21f5073717a01f564e27b8b6c092b03eee087190 Mon Sep 17 00:00:00 2001 From: d4rklynk Date: Sat, 18 Nov 2023 14:24:37 +0100 Subject: [PATCH 2/3] Fix port --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bd7cbe2..af9ebc9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,4 +47,4 @@ USER daemon ENTRYPOINT ["cmd/writefreely/writefreely"] HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \ - CMD curl -fSs http://localhost:8008/health || exit 1 \ No newline at end of file + CMD curl -fSs http://localhost:8080/health || exit 1 \ No newline at end of file From aac4514577548e8a740d0c465bf739aa0c15326c Mon Sep 17 00:00:00 2001 From: d4rklynk Date: Sat, 18 Nov 2023 14:30:54 +0100 Subject: [PATCH 3/3] Fix healthcheck URL --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index af9ebc9..762a1ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,4 +47,4 @@ USER daemon ENTRYPOINT ["cmd/writefreely/writefreely"] HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \ - CMD curl -fSs http://localhost:8080/health || exit 1 \ No newline at end of file + CMD curl -fSs http://localhost:8080/ || exit 1 \ No newline at end of file