Browse Source

Using multistage build for Dockerfile

master
Ryan Wark 4 years ago
parent
commit
d50c26794c
  1. 14
      Dockerfile

14
Dockerfile

@ -1,11 +1,17 @@
FROM golang:1.16-alpine
FROM golang:1.16 AS builder
WORKDIR /go/src/app
COPY . .
RUN go get -d -v ./...
RUN go install -v ./...
RUN CGO_ENABLED=0 GOOS=linux go get -d -v . && \
go build -a -tags netgo -o b56
FROM alpine:3.14
WORKDIR /app
COPY --from=builder /go/src/app/b56 .
COPY ./static ./static
EXPOSE 80
CMD ["b56"]
CMD ["/app/b56"]
Loading…
Cancel
Save