File tree 1 file changed +11
-7
lines changed
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 2
2
ARG alpine_version=3.20
3
3
ARG golang_version=1.22
4
4
5
- FROM golang:${golang_version}-alpine${alpine_version} as builder
5
+ FROM golang:${golang_version}-alpine${alpine_version} AS builder
6
6
ARG GIT_COMMIT
7
7
ARG GIT_BRANCH
8
8
ARG GIT_VERSION
@@ -13,13 +13,17 @@ RUN apk add --no-cache \
13
13
git \
14
14
make
15
15
16
- COPY /src /src
17
- WORKDIR /src
16
+ # Download dependencies first to cache them
17
+ WORKDIR /app
18
+ COPY ./src/go.mod ./src/go.sum ./
19
+ RUN go mod download
20
+
21
+ # Copy the source code and build
22
+ COPY /src ./
18
23
RUN make build
19
24
20
- FROM scratch as deploy
21
- COPY --from=builder /src/docker-event-monitor docker-event-monitor
22
- # the tls certificates:
23
- # this pulls directly from the upstream image, which already has ca-certificates:
25
+ FROM scratch AS deploy
26
+ COPY --from=builder /app/docker-event-monitor docker-event-monitor
27
+ # this pulls directly from the upstream image, which already has ca-certificates
24
28
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
25
29
ENTRYPOINT ["/docker-event-monitor" ]
You can’t perform that action at this time.
0 commit comments