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/>.
|
|
|
|
|
2023-11-25 15:01:35 +01:00
|
|
|
ARG GOLANG_VERSION=1.21
|
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
|
|
|
|
2023-11-25 15:01:35 +01:00
|
|
|
ARG WRITEFREELY_VERSION=v0.14.0
|
2020-02-19 14:08:12 +01:00
|
|
|
ARG WRITEFREELY_FORK=writeas/writefreely
|
2019-12-28 17:53:16 +01:00
|
|
|
|
2021-09-28 18:33:15 +02:00
|
|
|
RUN apk add --update nodejs npm make g++ git sqlite-dev
|
2020-02-19 14:03:45 +01:00
|
|
|
RUN npm install -g less less-plugin-clean-css
|
|
|
|
RUN go get -u github.com/jteeuwen/go-bindata/...
|
|
|
|
|
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
|
|
|
|
RUN make build \
|
|
|
|
&& make ui
|
|
|
|
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
|
2023-11-25 15:01:35 +01:00
|
|
|
FROM alpine:3.18
|
2019-12-28 17:53:16 +01:00
|
|
|
|
2020-02-19 14:03:45 +01:00
|
|
|
RUN apk add --no-cache openssl ca-certificates
|
|
|
|
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
|
|
|
|
|
|
|
|
ENTRYPOINT ["/writefreely/writefreely-docker.sh"]
|