forked from runs-on/runs-on
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (21 loc) · 848 Bytes
/
Dockerfile
File metadata and controls
29 lines (21 loc) · 848 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
FROM golang:1.22 AS build
ENV GOCACHE=/root/.gocache
ENV CGO_ENABLED=0
ENV UPX_VERSION=4.2.4
RUN apt-get update && apt-get install -y xz-utils
# https://upx.github.io/
RUN curl -L https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz -o upx-${UPX_VERSION}-amd64_linux.tar.xz && \
tar -xf upx-${UPX_VERSION}-amd64_linux.tar.xz && \
mv upx-${UPX_VERSION}-amd64_linux/upx /usr/local/bin/upx
WORKDIR /app
COPY server/go.* ./
RUN go mod download
COPY server/ ./
RUN --mount=type=cache,target=/root/.gocache make server
RUN --mount=type=cache,target=/root/.gocache make agent
FROM gcr.io/distroless/static-debian12
WORKDIR /app
# Copy the binary to the production image from the builder stage.
COPY --from=build /app/dist /app/dist
ENV RUNS_ON_AGENT_FOLDER="/app/dist"
CMD ["/app/dist/server"]