-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 821 Bytes
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 821 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM golang:1.20 AS builder
COPY src/go.mod src/go.sum ./
RUN unset GOPATH && go mod tidy && go mod download
FROM builder AS builder-02
COPY src/. .
RUN unset GOPATH && CGO_ENABLED=0 go build -o bin/main .
FROM ubuntu:20.04 AS final
ARG GIN_MODE=release
ARG USER=saml-proxy
ARG GROUP=saml
ARG UID=1001
ARG GID=1001
ENV GIN_MODE=$GIN_MODE
ENV USER=$USER
ENV GROUP=$GROUP
ENV UID=$UID
ENV GID=$GID
RUN DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt-get upgrade -y
RUN addgroup $GROUP
RUN adduser \
--disabled-password \
--gecos "" \
--home "$(pwd)" \
--ingroup "$GROUP" \
--no-create-home \
--uid "$UID" \
"$USER"
COPY --from=builder-02 /go/bin/main /saml-proxy/main
RUN chown -R $GID:$UID /saml-proxy
USER $USER
EXPOSE 9000
WORKDIR /saml-proxy
ENTRYPOINT ["./main"]