dockron/Dockerfile.multi-stage

20 lines
379 B
Docker
Raw Permalink Normal View History

2019-06-08 00:08:15 +00:00
ARG REPO=library
2019-08-10 01:05:17 +00:00
FROM ${REPO}/golang:1.12-alpine AS builder
2019-06-08 00:08:15 +00:00
2019-08-10 01:05:17 +00:00
RUN apk add --no-cache git
2019-06-08 00:08:15 +00:00
2019-08-10 01:05:17 +00:00
RUN mkdir /app
WORKDIR /app
2019-06-08 00:08:15 +00:00
2019-08-10 01:05:17 +00:00
COPY ./go.mod ./go.sum /app/
RUN go mod download
2019-06-08 00:08:15 +00:00
2019-08-10 01:05:17 +00:00
COPY ./main.go /app/
2019-06-08 00:08:15 +00:00
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -installsuffix nocgo -o dockron .
FROM ${REPO}/busybox:latest
WORKDIR /root/
2019-08-10 01:05:17 +00:00
COPY --from=builder /app/dockron .
2019-06-08 00:08:15 +00:00
CMD [ "./dockron" ]