forked from jordemort/traefik-forward-auth
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
29 lines (22 loc) · 931 Bytes
/
Dockerfile
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
26
27
28
29
# Start by building the application.
FROM --platform=$BUILDPLATFORM golang:1.22 as build
WORKDIR /usr/src/traefik-forward-auth
ENV CGO_ENABLED 0
COPY ./go.* ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY . .
ARG TARGETOS
ARG TARGETARCH
ENV GOOS=$TARGETOS
ENV GOARCH=$TARGETARCH
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
go build -o ./traefik-forward-auth -ldflags "-s -w" -tags "viper_bind_struct" ./cmd
# Now copy it into our base image.
FROM gcr.io/distroless/static-debian11:nonroot
COPY --from=build /usr/src/traefik-forward-auth/traefik-forward-auth /usr/bin/traefik-forward-auth
ENTRYPOINT ["/usr/bin/traefik-forward-auth"]
CMD []
LABEL org.opencontainers.image.title=traefik-forward-auth
LABEL org.opencontainers.image.description="Forward authentication service for the Traefik reverse proxy"
LABEL org.opencontainers.image.licenses=MIT