-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (46 loc) · 2.19 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (46 loc) · 2.19 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM golang:1.24 AS build
WORKDIR /src
# Cache module downloads and build artifacts with BuildKit
# 1) copy only go.mod/sum first to maximize cache hits
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download
# 2) copy the rest of the source and build using cached mounts
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -o /bootstrap ./cmd/bootstrap && \
go build -o /maintainerd ./main.go && \
go build -o /sync ./cmd/sync && \
go build -o /dot-project-sync ./cmd/dot-project-sync && \
go build -o /sanitize ./cmd/sanitize && \
go build -o /migrate ./cmd/migrate && \
go build -o /onboarding-backfill ./cmd/onboarding-backfill && \
go build -o /fossa-poller ./cmd/fossa-poller && \
go build -o /github-profile-sync ./cmd/github-profile-sync
FROM gcr.io/distroless/base-debian12 AS maintainerd
COPY --from=build /bootstrap /usr/local/bin/bootstrap
COPY --from=build /maintainerd /usr/local/bin/maintainerd
ENTRYPOINT ["/usr/local/bin/maintainerd"]
FROM gcr.io/distroless/base-debian12 AS sync
COPY --from=build /sync /usr/local/bin/sync
ENTRYPOINT ["/usr/local/bin/sync"]
FROM gcr.io/distroless/base-debian12 AS dot-project-sync
COPY --from=build /dot-project-sync /usr/local/bin/dot-project-sync
ENTRYPOINT ["/usr/local/bin/dot-project-sync"]
FROM gcr.io/distroless/base-debian12 AS sanitize
COPY --from=build /sanitize /usr/local/bin/sanitize
ENTRYPOINT ["/usr/local/bin/sanitize"]
FROM gcr.io/distroless/base-debian12 AS migrate
COPY --from=build /migrate /usr/local/bin/migrate
ENTRYPOINT ["/usr/local/bin/migrate"]
FROM gcr.io/distroless/base-debian12 AS onboarding-backfill
COPY --from=build /onboarding-backfill /usr/local/bin/onboarding-backfill
ENTRYPOINT ["/usr/local/bin/onboarding-backfill"]
FROM gcr.io/distroless/base-debian12 AS fossa-poller
COPY --from=build /fossa-poller /usr/local/bin/fossa-poller
ENTRYPOINT ["/usr/local/bin/fossa-poller"]
FROM gcr.io/distroless/base-debian12 AS github-profile-sync
COPY --from=build /github-profile-sync /usr/local/bin/github-profile-sync
ENTRYPOINT ["/usr/local/bin/github-profile-sync"]