Skip to content

Commit

Permalink
Fix Containerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
snorwin committed Dec 29, 2023
1 parent b12f7d5 commit d979350
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM golang:1.21-bullseye as builder
RUN apt-get update && apt-get install -y upx

WORKDIR /workspace
COPY . /workspace

RUN go mod download
RUN GOOS=linux GOARCH=amd64 go build -a -o haproxy-operator main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o haproxy-operator main.go && \
upx -q haproxy-operator

FROM scratch
FROM gcr.io/distroless/static:nonroot
ENTRYPOINT ["/opt/go/haproxy-operator"]
WORKDIR /opt/go/
COPY --from=builder /workspace/haproxy-operator /opt/go/haproxy-operator
USER 1001:1001
ENTRYPOINT ["/opt/go/haproxy-operator"]
USER 1001:1001

0 comments on commit d979350

Please sign in to comment.