mirror of
https://github.com/writeas/writefreely
synced 2025-02-06 19:43:43 +01:00
Enabling go modules requires that GO111MODULE is set, so we set it as an environment variable in the Dockerfile. Also, go-bindata is meant to be installed globally, so we force the install before enabling Go modules. Also, we update Go to 1.12 to fix a couple module builds.
35 lines
843 B
Docker
35 lines
843 B
Docker
# Build image
|
|
FROM golang:1.12-alpine as build
|
|
|
|
RUN apk add --update nodejs nodejs-npm make g++ git sqlite-dev
|
|
RUN npm install -g less less-plugin-clean-css
|
|
RUN go get -u github.com/jteeuwen/go-bindata/...
|
|
|
|
RUN mkdir -p /go/src/github.com/writeas/writefreely
|
|
WORKDIR /go/src/github.com/writeas/writefreely
|
|
COPY . .
|
|
|
|
ENV GO111MODULE=on
|
|
RUN make build \
|
|
&& make ui
|
|
RUN mkdir /stage && \
|
|
cp -R /go/bin \
|
|
/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 \
|
|
/stage
|
|
|
|
# Final image
|
|
FROM alpine:3.8
|
|
|
|
RUN apk add --no-cache openssl ca-certificates
|
|
COPY --from=build --chown=daemon:daemon /stage /go
|
|
|
|
WORKDIR /go
|
|
VOLUME /go/keys
|
|
EXPOSE 8080
|
|
USER daemon
|
|
|
|
CMD ["bin/writefreely"]
|