Skip to content

Commit

Permalink
docker: build improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzz1y committed Dec 15, 2024
1 parent ef669c5 commit 18bdd94
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
FROM golang:1.23-alpine as builder
FROM golang:1.23-alpine AS builder

# Setup
RUN mkdir -p /go/src/github.com/mesosphere/traefik-forward-auth
WORKDIR /go/src/github.com/mesosphere/traefik-forward-auth

# Add libraries
RUN apk add --no-cache git

# Copy & build
ADD . /go/src/github.com/mesosphere/traefik-forward-auth/
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -installsuffix nocgo -o /traefik-forward-auth github.com/mesosphere/traefik-forward-auth/cmd
COPY . /src
RUN \
cd /src && \
CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -o /traefik-forward-auth ./cmd

# Copy into scratch container
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /traefik-forward-auth ./
ENTRYPOINT ["./traefik-forward-auth"]
COPY --from=builder /traefik-forward-auth /
ENTRYPOINT ["/traefik-forward-auth"]

0 comments on commit 18bdd94

Please sign in to comment.