e3ca393d9e
This rearranges the Dockerfile to COPY over the go module files for downloading prior to building, linting, and testing. This will allow developers to more quickly test their code via Docker given that their dependencies change infrequently. Change-Id: I3650fbd9ca18d453921d25a536e8b4cf60ce1b5e
20 lines
518 B
Docker
20 lines
518 B
Docker
ARG GO_IMAGE=docker.io/golang:1.13.1-stretch
|
|
ARG RELEASE_IMAGE=scratch
|
|
FROM ${GO_IMAGE} as builder
|
|
|
|
SHELL [ "/bin/bash", "-cex" ]
|
|
WORKDIR /usr/src/airshipctl
|
|
|
|
# Take advantage of caching for dependency acquisition
|
|
COPY go.mod go.sum /usr/src/airshipctl/
|
|
RUN go mod download
|
|
|
|
COPY . /usr/src/airshipctl/
|
|
ARG MAKE_TARGET=build
|
|
RUN make ${MAKE_TARGET}
|
|
|
|
FROM ${RELEASE_IMAGE} as release
|
|
COPY --from=builder /usr/src/airshipctl/bin/airshipctl /usr/local/bin/airshipctl
|
|
USER 65534
|
|
ENTRYPOINT [ "/usr/local/bin/airshipctl" ]
|