-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
33 lines (24 loc) · 829 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
30
31
32
33
############################
# STEP 1 build executable binary
############################
FROM golang as builder
WORKDIR $GOPATH/salt-api-oauth2-middleware/
COPY . .
RUN go mod vendor
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /go/bin/salt-api-oauth2-middleware -mod vendor main.go
############################
# STEP 2 ca-certificates
############################
FROM alpine:3 as alpine
RUN apk add -U --no-cache ca-certificates
############################
# STEP 3 build a small image
############################
FROM scratch
ENV GIN_MODE=release
WORKDIR /app/
# Import from builder.
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/bin/salt-api-oauth2-middleware /app/salt-api-oauth2-middleware
ENTRYPOINT ["/app/salt-api-oauth2-middleware"]
EXPOSE 8080