28 lines
1.0 KiB
Docker

FROM golang:bookworm AS build
ARG VERSION
WORKDIR /app
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
RUN apt update && apt install -y wget
RUN wget https://github.com/writefreely/writefreely/releases/download/v${VERSION}/writefreely_${VERSION}_linux_amd64.tar.gz -O writefreies.tar.gz
RUN tar -xzf writefreies.tar.gz && rm writefreies.tar.gz
RUN apt install -y make g++ git libsqlite3-dev
RUN git clone https://github.com/writefreely/writefreely.git -b v${VERSION} --depth 1 /tmp/writefreely
RUN sed -i -e 's/outHTML := string(policy.SanitizeBytes(md))/outHTML := string(md)/g' \
/tmp/writefreely/postrender.go
RUN make -C /tmp/writefreely build
RUN mv /tmp/writefreely/cmd/writefreely/writefreely /app/writefreely
FROM debian:bookworm
WORKDIR /app
RUN chown 1000:1000 /app
COPY --from=build /docker-entrypoint.sh /
COPY --from=build /app/writefreely /app
USER 1000:1000
VOLUME ["/app/keys", "/app/data"]
EXPOSE 9000/tcp
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/app/writefreely", "-c", "/app/data/config.ini"]