generated from cisco-ospo/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
29 lines (23 loc) · 919 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
############################
# STEP 1 build the image for creating the executable
############################
FROM docker.io/library/golang:1.23.1-alpine3.20 as builder
# Install git + SSL ca certificates + make
# Git is required for fetching the dependencies.
# Ca-certificates is required to call HTTPS endpoints.
# Make to build go application
RUN apk update && apk upgrade && apk add --no-cache git ca-certificates make unzip g++ && update-ca-certificates && apk --no-cache add openssl wget && rm -rf /var/cache/apk/*
# Create appuser
RUN adduser -D -g '' appuser
WORKDIR /app
COPY . .
# Compile the binary
RUN cd restapi && make build-restapi
############################
# STEP 2 build a small image with only the executable
############################
FROM gcr.io/distroless/static:nonroot
WORKDIR /app/
COPY --from=builder /app/restapi/bin/restapi /app/restapi
USER 65532:65532
ENTRYPOINT ["./restapi"]