From 70b2cc47bb68162681f0e0605b23d299344819ab Mon Sep 17 00:00:00 2001 From: Danny Date: Fri, 8 Jun 2018 14:14:52 +0200 Subject: [PATCH] build npm assets in intermedia docker container so we can auto-build from git push. relates to #49 #51 --- Dockerfile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4cd583a..3c137b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,19 @@ -FROM golang:latest AS compiler +FROM node:alpine AS assetbuilder +WORKDIR /app +COPY package*.json ./ +COPY gulpfile.js ./ +COPY assets/ ./assets/ +RUN npm install && NODE_ENV=production npx gulp + +FROM golang:latest AS binarybuilder WORKDIR /go/src/github.com/usefathom/fathom -ADD . /go/src/github.com/usefathom/fathom +COPY . /go/src/github.com/usefathom/fathom +COPY --from=assetbuilder /app/assets/build ./assets/build RUN go get -u github.com/gobuffalo/packr/... && make docker FROM alpine:latest EXPOSE 8080 RUN apk add --update --no-cache bash ca-certificates WORKDIR /app -COPY --from=compiler /go/src/github.com/usefathom/fathom/fathom . +COPY --from=binarybuilder /go/src/github.com/usefathom/fathom/fathom . CMD ["./fathom", "server"]