2019-12-28 17:53:16 +01:00
## Writefreely Docker image
2020-02-19 14:03:45 +01:00
## Copyright (C) 2019, 2020 Gergely Nagy
2019-12-28 17:53:16 +01:00
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
2024-05-19 15:48:51 +03:00
ARG GOLANG_VERSION=1.22
2021-09-28 18:33:15 +02:00
2019-12-28 17:53:16 +01:00
# Build image
2021-09-28 18:33:15 +02:00
FROM golang:${GOLANG_VERSION}-alpine as build
2019-12-28 17:53:16 +01:00
2024-05-19 15:48:51 +03:00
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."
ARG WRITEFREELY_VERSION=v0.15.0
2020-02-19 14:08:12 +01:00
ARG WRITEFREELY_FORK=writeas/writefreely
2019-12-28 17:53:16 +01:00
2024-05-19 15:48:51 +03:00
RUN apk -U upgrade \
&& apk add --no-cache nodejs npm make g++ git sqlite-dev \
&& npm install -g less less-plugin-clean-css \
&& mkdir -p /go/src/github.com/writefreely/writefreely
2020-02-19 14:03:45 +01:00
RUN npm install -g less less-plugin-clean-css
2020-02-19 14:08:12 +01:00
RUN mkdir -p /go/src/github.com/${WRITEFREELY_FORK}
RUN git clone https://github.com/${WRITEFREELY_FORK}.git /go/src/github.com/${WRITEFREELY_FORK} -b ${WRITEFREELY_VERSION}
WORKDIR /go/src/github.com/${WRITEFREELY_FORK}
2020-02-19 14:03:45 +01:00
ENV GO111MODULE=on
2024-05-19 15:48:51 +03:00
ENV NODE_OPTIONS=--openssl-legacy-provider
2020-02-19 14:03:45 +01:00
RUN make build \
&& make ui
2024-05-19 15:48:51 +03:00
2020-02-19 14:03:45 +01:00
RUN mkdir /stage && \
cp -R /go/bin \
2020-02-19 14:08:12 +01:00
/go/src/github.com/${WRITEFREELY_FORK}/templates \
/go/src/github.com/${WRITEFREELY_FORK}/static \
/go/src/github.com/${WRITEFREELY_FORK}/pages \
/go/src/github.com/${WRITEFREELY_FORK}/keys \
/go/src/github.com/${WRITEFREELY_FORK}/cmd \
2020-02-19 14:03:45 +01:00
/stage && \
mv /stage/cmd/writefreely/writefreely /stage
2019-12-28 17:53:16 +01:00
# Final image
2024-05-19 15:48:51 +03:00
FROM alpine:3.19
2019-12-28 17:53:16 +01:00
2024-05-19 15:48:51 +03:00
RUN apk -U upgrade && apk add --no-cache openssl ca-certificates
2020-02-19 14:03:45 +01:00
COPY --from=build --chown=daemon:daemon /stage /writefreely
2019-12-28 17:53:16 +01:00
COPY bin/writefreely-docker.sh /writefreely/
WORKDIR /writefreely
VOLUME /data
EXPOSE 8080
2024-05-19 15:48:51 +03:00
USER daemon
2019-12-28 17:53:16 +01:00
ENTRYPOINT ["/writefreely/writefreely-docker.sh"]
2024-05-19 15:48:51 +03:00
HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \
CMD curl -fSs http://localhost:8080/ || exit 1