Skip to content

Instantly share code, notes, and snippets.

@montanaflynn
Created March 7, 2018 03:43
Show Gist options
  • Save montanaflynn/becb3a54482cc8fb8b1067b94f3e2695 to your computer and use it in GitHub Desktop.
Save montanaflynn/becb3a54482cc8fb8b1067b94f3e2695 to your computer and use it in GitHub Desktop.
Multiple stage go / javascript build
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