From 402e9e822cb920b378bc871210ee971b9e8371e1 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Fri, 19 Apr 2019 12:48:16 +0200 Subject: [PATCH 1/2] Fix the build in Docker after enabling go modules 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. --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ed0a3a2..a1d23a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,15 @@ # Build image -FROM golang:1.11.2-alpine3.8 as build +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 && \ From 70f754e8af11f299b75c5c615a117387050a1f3c Mon Sep 17 00:00:00 2001 From: kaiyou Date: Fri, 19 Apr 2019 13:05:01 +0200 Subject: [PATCH 2/2] Install the writefreely cmd properly --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a1d23a5..2ae05a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ RUN mkdir /stage && \ /go/src/github.com/writeas/writefreely/static \ /go/src/github.com/writeas/writefreely/pages \ /go/src/github.com/writeas/writefreely/keys \ + /go/src/github.com/writeas/writefreely/cmd \ /stage # Final image @@ -31,4 +32,4 @@ VOLUME /go/keys EXPOSE 8080 USER daemon -CMD ["bin/writefreely"] +ENTRYPOINT ["cmd/writefreely/writefreely"]