Created
March 7, 2018 03:43
-
-
Save montanaflynn/becb3a54482cc8fb8b1067b94f3e2695 to your computer and use it in GitHub Desktop.
Multiple stage go / javascript build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.10 as builder | |
WORKDIR /workplace/ | |
COPY src . | |
RUN go get gopkg.in/redis.v3 | |
RUN CGO_ENABLED=0 GOOS=linux go build -o ./server | |
FROM node:6-alpine as minifier | |
WORKDIR /workplace/ | |
COPY assets . | |
RUN npm install -g minifier | |
RUN minifier | |
FROM alpine:latest | |
RUN apk --no-cache add ca-certificates | |
WORKDIR /root/ | |
COPY --from=builder /workplace/server . | |
COPY --from=minifier /workplace/ . | |
CMD ["./server"] | |
EXPOSE 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment