2019-01-16 21:05:52 +01:00
|
|
|
# Build image
|
2020-10-26 14:50:11 +01:00
|
|
|
FROM golang:1.14-alpine as build
|
2018-11-14 05:24:06 +01:00
|
|
|
|
2020-10-26 14:50:11 +01:00
|
|
|
RUN apk add --update nodejs nodejs-npm make g++ git
|
2019-01-16 21:05:52 +01:00
|
|
|
RUN npm install -g less less-plugin-clean-css
|
2020-10-26 14:50:11 +01:00
|
|
|
RUN go get -u github.com/go-bindata/go-bindata/...
|
2018-11-14 05:24:06 +01:00
|
|
|
|
2019-01-16 21:05:52 +01:00
|
|
|
RUN mkdir -p /go/src/github.com/writeas/writefreely
|
|
|
|
WORKDIR /go/src/github.com/writeas/writefreely
|
2020-10-26 14:50:11 +01:00
|
|
|
|
2018-11-14 05:24:06 +01:00
|
|
|
COPY . .
|
|
|
|
|
2019-04-19 12:48:16 +02:00
|
|
|
ENV GO111MODULE=on
|
2020-10-26 14:50:11 +01:00
|
|
|
|
2019-01-16 21:05:52 +01:00
|
|
|
RUN make build \
|
2020-10-26 14:50:11 +01:00
|
|
|
&& make ui
|
2018-11-21 17:38:56 +01:00
|
|
|
RUN mkdir /stage && \
|
|
|
|
cp -R /go/bin \
|
2019-01-16 21:05:52 +01:00
|
|
|
/go/src/github.com/writeas/writefreely/templates \
|
|
|
|
/go/src/github.com/writeas/writefreely/static \
|
|
|
|
/go/src/github.com/writeas/writefreely/pages \
|
|
|
|
/go/src/github.com/writeas/writefreely/keys \
|
2019-04-19 13:05:01 +02:00
|
|
|
/go/src/github.com/writeas/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
|
2020-10-26 14:50:11 +01:00
|
|
|
FROM alpine:3.12
|
2018-11-21 17:38:56 +01:00
|
|
|
|
2018-12-05 13:33:13 +01:00
|
|
|
RUN 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"]
|