2019-06-07 17:08:15 -07:00
|
|
|
ARG REPO=library
|
2020-08-16 14:46:35 -07:00
|
|
|
FROM golang:1.15-alpine AS builder
|
2019-06-07 17:08:15 -07:00
|
|
|
|
2020-08-07 15:00:30 -07:00
|
|
|
# hadolint ignore=DL3018
|
2019-06-07 17:08:15 -07:00
|
|
|
RUN apk add --no-cache git
|
|
|
|
|
|
|
|
RUN mkdir /app
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
COPY ./go.mod ./go.sum /app/
|
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
COPY ./main.go /app/
|
2020-08-16 14:46:35 -07:00
|
|
|
COPY ./slog /app/slog
|
2019-08-14 10:59:51 -07:00
|
|
|
|
2019-08-14 10:40:19 -07:00
|
|
|
ARG ARCH=amd64
|
|
|
|
ARG VERSION=dev
|
|
|
|
ENV CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH}
|
2019-08-14 10:59:51 -07:00
|
|
|
RUN go build -ldflags "-X main.version=${VERSION}" -a -installsuffix nocgo -o dockron .
|
2019-06-07 17:08:15 -07:00
|
|
|
|
2020-08-07 15:00:30 -07:00
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /app/dockron /
|
2019-06-07 17:08:15 -07:00
|
|
|
|
2020-08-07 15:00:30 -07:00
|
|
|
ENTRYPOINT [ "/dockron" ]
|