Use alpine for builder in Dockerfile

This commit is contained in:
Torjus Håkestad 2021-12-04 10:25:54 +01:00
parent 1b2cb55843
commit 3c72409c5c

View File

@ -1,14 +1,10 @@
FROM golang:latest as builder-base FROM golang:alpine as builder-base
WORKDIR /app WORKDIR /app
COPY go.mod /app/go.mod COPY go.mod /app/go.mod
COPY go.sum /app/go.sum COPY go.sum /app/go.sum
RUN go mod download RUN go mod download
COPY . /app COPY . /app
RUN CGO_ENABLED=0 go build -o ezshare cmd/ezshare.go RUN go build -o ezshare cmd/ezshare.go
FROM builder-base as certs
VOLUME ["/data"]
CMD ["/app/scripts/gencerts.sh"]
FROM builder-base as cross-compiler FROM builder-base as cross-compiler
VOLUME ["/data"] VOLUME ["/data"]