File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM golang:1.24.3 AS build
2+ WORKDIR /app/src
3+
4+ ENV GOCACHE=/root/.cache/go-build
5+ ENV GOMODCACHE=/root/.cache/go-build
6+ ENV GO111MODULE=on
7+ ENV CGO_ENABLED=0
8+ ENV GOOS=linux
9+
10+ # Leverage build cache by copying go.mod and go.sum first
11+ COPY go.mod go.sum ./
12+ RUN --mount=type=cache,target=/root/.cache/go-build go mod download
13+ RUN go mod verify
14+
15+ # Copy the rest of the source code
16+ COPY . .
17+
18+ RUN --mount=type=cache,target="/root/.cache/go-build" go build -o ./chargeflow ./cmd
19+
20+ FROM debian:buster-slim as app
21+
22+ RUN apt-get update
23+
24+ SHELL ["/bin/sh" , "-l" , "-c" ]
25+
26+ ARG user=app
27+ ARG group=docker
28+ RUN addgroup $group
29+ RUN adduser \
30+ --disabled-password \
31+ --gecos "" \
32+ --ingroup $group \
33+ $user
34+ USER $user
35+
36+ WORKDIR /usr/local/bin
37+
38+ # Copy the binary and set execute permissions
39+ COPY --chown=$user:$group --from=build /app/chargeflow /usr/local/bin/chargeflow
40+ RUN chmod +x /usr/local/bin/chargeflow
41+
42+ CMD ["/usr/local/bin/chargeflow" ]
Load diff This file was deleted.
You can’t perform that action at this time.
0 commit comments