-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (29 loc) · 918 Bytes
/
Dockerfile
File metadata and controls
43 lines (29 loc) · 918 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
FROM golang:1.26.1-alpine AS build
ARG build_commit_sha="-"
ARG build_version="-"
ARG build_time="-"
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
RUN mkdir -p /app/src \
&& mkdir -p /app/bin
WORKDIR /app/src
COPY go.mod go.sum ./
RUN go mod download && \
go mod verify
COPY . ./
RUN go build -v \
-o /app/bin/playerpath \
-ldflags="-s -w -X 'main.buildTime=$build_time' -X 'main.buildCommit=$build_commit_sha' -X 'main.buildVersion=$build_version'" \
/app/src/cmd/playerpath
RUN go build -v \
-o /app/bin/importer \
-ldflags="-s -w -X 'main.buildTime=$build_time' -X 'main.buildCommit=$build_commit_sha' -X 'main.buildVersion=$build_version'" \
/app/src/cmd/importer
FROM gcr.io/distroless/base-debian11
WORKDIR /
COPY --from=build /app/bin/playerpath /playerpath
COPY --from=build /app/bin/importer /importer
EXPOSE 8080
USER nonroot:nonroot
CMD [ "/playerpath" ]