2019-01-16 21:05:52 +01:00
# Build image
2023-11-18 14:18:39 +01:00
# SHA256 of golang:1.21-alpine3.18 linux/amd64
FROM golang@sha256:f475434ea2047a83e9ba02a1da8efc250fa6b2ed0e9e8e4eb8c5322ea6997795 as build
2018-11-14 05:24:06 +01:00
2023-11-18 14:18:39 +01:00
LABEL org.opencontainers.image.source= "https://github.com/writefreely/writefreely"
2023-09-07 21:46:45 +02:00
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."
2023-11-18 14:18:39 +01:00
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
2018-11-14 05:24:06 +01:00
2021-04-06 23:24:07 +02:00
WORKDIR /go/src/github.com/writefreely/writefreely
2020-10-26 14:50:11 +01:00
2018-11-14 05:24:06 +01:00
COPY . .
2023-01-20 12:36:11 +01:00
RUN cat ossl_legacy.cnf > /etc/ssl/openssl.cnf
2019-04-19 12:48:16 +02:00
ENV GO111MODULE = on
2023-01-20 12:36:11 +01:00
ENV NODE_OPTIONS = --openssl-legacy-provider
2020-10-26 14:50:11 +01:00
2019-01-16 21:05:52 +01:00
RUN make build \
2023-11-18 14:18:39 +01:00
&& make ui \
&& mkdir /stage \
&& cp -R /go/bin \
2021-04-06 23:24:07 +02:00
/go/src/github.com/writefreely/writefreely/templates \
/go/src/github.com/writefreely/writefreely/static \
/go/src/github.com/writefreely/writefreely/pages \
/go/src/github.com/writefreely/writefreely/keys \
/go/src/github.com/writefreely/writefreely/cmd \
2018-11-22 13:57:05 +01:00
/stage
2018-11-21 17:38:56 +01:00
2019-01-16 21:05:52 +01:00
# Final image
2023-11-18 14:18:39 +01:00
# SHA256 of alpine:3.18.4 linux/amd64
FROM alpine@sha256:48d9183eb12a05c99bcc0bf44a003607b8e941e1d4f41f9ad12bdcc4b5672f86
RUN apk -U upgrade \
&& apk add --no-cache openssl ca-certificates
2018-11-21 17:38:56 +01:00
COPY --from= build --chown= daemon:daemon /stage /go
2018-11-21 19:51:37 +01:00
WORKDIR /go
2018-11-21 17:38:56 +01:00
VOLUME /go/keys
2018-11-14 05:24:06 +01:00
EXPOSE 8080
2018-11-21 17:38:56 +01:00
USER daemon
2019-04-19 13:05:01 +02:00
ENTRYPOINT [ "cmd/writefreely/writefreely" ]
2023-11-18 14:18:39 +01:00
HEALTHCHECK --start-period= 5s --interval= 15s --timeout= 5s \
2023-11-18 14:30:54 +01:00
CMD curl -fSs http://localhost:8080/ || exit 1