Browse Source

Changing to build in a smaller container and only package the build Go binary

master
Ryan Wark 4 years ago
parent
commit
e4373a0e77
  1. 11
      Dockerfile

11
Dockerfile

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