forked from Cogwheel-Validator/spectra-gnoland-indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile-api
More file actions
30 lines (21 loc) · 656 Bytes
/
Copy pathDockerfile-api
File metadata and controls
30 lines (21 loc) · 656 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
FROM golang:1.25 AS builder
WORKDIR /app
COPY . .
ARG GIT_COMMIT=""
ARG GIT_TAG=""
ARG GIT_BRANCH=""
ARG VERSION=""
RUN if [ -z "$VERSION" ]; then \
if [ -n "$GIT_TAG" ]; then VERSION="$GIT_TAG"; \
else VERSION="${GIT_BRANCH}-${GIT_COMMIT}"; \
fi; \
fi && \
go build -ldflags="-s -w -X main.Commit=${GIT_COMMIT} -X main.Version=${VERSION}" -o build/api ./api
RUN touch config-api.yml
RUN chmod +x build/api
FROM gcr.io/distroless/base-debian13:latest
WORKDIR /app
COPY --from=builder --chown=nonroot:nonroot /app/build/api .
COPY --from=builder --chown=nonroot:nonroot /app/config-api.yml .
USER nonroot
ENTRYPOINT ["/app/api"]