-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
94 lines (52 loc) · 2.8 KB
/
Dockerfile
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# SPDX-License-Identifier: GPL-3.0
## common: ##
FROM docker.io/library/golang:1.23.1-bookworm@sha256:1a5326b07cbab12f4fd7800425f2cf25ff2bd62c404ef41b56cb99669a710a83 as build-dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y protobuf-compiler libgpgme-dev && rm -rf /var/lib/apt/lists/*
RUN go install google.golang.org/protobuf/cmd/[email protected] && go install google.golang.org/grpc/cmd/[email protected] && go install github.com/ethereum/go-ethereum/cmd/[email protected]
FROM build-dependencies AS build-common
WORKDIR /app
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build go mod download && go mod verify
COPY pkg ./pkg
FROM docker.io/debian:bookworm-20240904-slim@sha256:a629e796d77a7b2ff82186ed15d01a493801c020eed5ce6adaa2704356f15a1c as run-common
# matching golang:1.23.1-bookworm above
RUN apt-get update && apt-get install -y libgpgme11 curl jq && rm -rf /var/lib/apt/lists/*
## p2p-helper: ##
FROM build-common AS build-p2p-helper
COPY cmd/ipfs-p2p-helper ./cmd/ipfs-p2p-helper
RUN --mount=type=cache,target=/root/.cache/go-build go build -v -o /usr/local/bin/ipfs-p2p-helper ./cmd/ipfs-p2p-helper
FROM run-common AS p2p-helper
COPY --from=build-p2p-helper /usr/local/bin/ipfs-p2p-helper /usr/local/bin/ipfs-p2p-helper
ENTRYPOINT ["ipfs-p2p-helper"]
FROM run-common AS p2p-helper-copy-local
COPY ./bin/ipfs-p2p-helper /usr/local/bin/ipfs-p2p-helper
ENTRYPOINT ["ipfs-p2p-helper"]
## server: ##
FROM build-common AS build-server
COPY cmd/tpodserver ./cmd/tpodserver
RUN --mount=type=cache,target=/root/.cache/go-build go build -v -o /usr/local/bin/tpodserver ./cmd/tpodserver
# RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=bind,source=.,target=/app go build -v -o /usr/local/bin/tpodserver ./cmd/tpodserver
FROM run-common AS server
COPY --from=build-server /usr/local/bin/tpodserver /usr/local/bin/tpodserver
ENTRYPOINT ["tpodserver"]
FROM run-common AS server-copy-local
COPY ./bin/tpodserver /usr/local/bin/tpodserver
ENTRYPOINT ["tpodserver"]
## autoscaler: ##
FROM build-common AS build-autoscaler
COPY autoscaler ./autoscaler
RUN --mount=type=cache,target=/root/.cache/go-build go build -v -o /usr/local/bin/autoscaler ./autoscaler
FROM run-common AS autoscaler
COPY --from=build-autoscaler /usr/local/bin/autoscaler /usr/local/bin/autoscaler
ENTRYPOINT ["autoscaler"]
## tpodproxy: ##
FROM build-common as build-tpodproxy
COPY cmd/tpodproxy/ ./cmd/tpodproxy
RUN --mount=type=cache,target=/root/.cache/go-build go build -v -o /usr/local/bin/tpodproxy ./cmd/tpodproxy
FROM run-common as tpodproxy
COPY --from=build-tpodproxy /usr/local/bin/tpodproxy /usr/local/bin/tpodproxy
ENTRYPOINT ["tpodproxy"]
FROM run-common AS tpodproxy-copy-local
COPY ./bin/tpodproxy /usr/local/bin/tpodproxy
ENTRYPOINT ["tpodproxy"]