-
Notifications
You must be signed in to change notification settings - Fork 184
/
Dockerfile
31 lines (27 loc) · 1.09 KB
/
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
30
31
# =============================================================================
# build stage
#
# install golang dependencies & build binaries
# =============================================================================
FROM golang:1.21 AS build
ENV GOFLAGS='-ldflags=-s -ldflags=-w'
ENV CGO_ENABLED=0
ENV GO111MODULE=on
WORKDIR /go/src/github.com/buzzfeed/sso
COPY ./go.mod ./go.sum ./
RUN go mod download
COPY . .
RUN cd cmd/sso-auth && go build -mod=readonly -o /bin/sso-auth
RUN cd cmd/sso-proxy && go build -mod=readonly -o /bin/sso-proxy
RUN cd cmd/sso-proxy/generate-request-signature && go build -mod=readonly -o /bin/sso-generate-request-signature
# =============================================================================
# final stage
#
# add static assets and copy binaries from build stage
# =============================================================================
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/* \
&& groupadd -r sso && useradd -r -g sso sso
WORKDIR /sso
COPY --from=build /bin/sso-* /bin/
USER sso