forked from adevinta/noe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
25 lines (23 loc) · 786 Bytes
/
Dockerfile
File metadata and controls
25 lines (23 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# syntax=docker/dockerfile:1
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.20 as builder
ARG TARGETPLATFORM
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY vendor/ vendor/
# Copy the go source
COPY cmd/ cmd/
COPY pkg/ pkg/
# Build
RUN CGO_ENABLED=0 GOARCH=$(echo ${TARGETPLATFORM:-linux/amd64} | cut -d/ -f2) go build -mod=vendor -a -o manager ./cmd/noe/main.go
# 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
FROM debian
WORKDIR /
RUN apt-get update && apt-get install -y ca-certificates
COPY --from=builder /workspace/manager .
# USER nonroot:nonroot
ENTRYPOINT ["/manager"]