Files
actions-runner-controller/Dockerfile

38 lines
918 B
Docker
Raw Normal View History

2020-01-28 15:03:23 +09:00
# Build the manager binary
2020-11-10 17:16:04 +09:00
FROM golang:1.15 as builder
2020-01-28 15:03:23 +09:00
ARG TARGETPLATFORM
2020-01-28 15:03:23 +09:00
WORKDIR /workspace
ENV GO111MODULE=on \
CGO_ENABLED=0
2020-01-28 15:03:23 +09:00
# Copy the Go Modules manifests
COPY go.mod go.sum ./
2020-01-28 15:03:23 +09:00
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY . .
2020-01-28 15:03:23 +09:00
# Build
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3 | cut -c2-) && \
go build -a -o manager main.go
2020-01-28 15:03:23 +09:00
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
2020-01-28 15:03:23 +09:00
WORKDIR /
2020-01-28 15:03:23 +09:00
COPY --from=builder /workspace/manager .
2020-01-28 15:03:23 +09:00
USER nonroot:nonroot
ENTRYPOINT ["/manager"]