-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.local
More file actions
124 lines (94 loc) · 4.24 KB
/
Dockerfile.local
File metadata and controls
124 lines (94 loc) · 4.24 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Multi-stage build for relayer + bootstrap tools
# Using full golang image (not alpine) for toolchain auto-download support
FROM golang:1.23 AS builder
WORKDIR /app
# Allow Go toolchain to auto-upgrade for dependencies requiring newer versions
ENV GOTOOLCHAIN=auto
# Copy go mod files first and download deps - this layer is cached unless go.mod/go.sum change
COPY go.mod go.sum ./
RUN go mod download
# Copy source code (this layer changes frequently but deps are already cached)
COPY . .
# Build all binaries
# CGO_ENABLED=0 creates static binaries compatible with alpine
RUN CGO_ENABLED=0 go build -o /app/bin/relayer ./cmd/relayer && \
CGO_ENABLED=0 go build -o /app/bin/api-server ./cmd/api-server && \
CGO_ENABLED=0 go build -o /app/bin/indexer ./cmd/indexer && \
CGO_ENABLED=0 go build -o /app/bin/api-server-migrate ./cmd/api-server/migrate && \
CGO_ENABLED=0 go build -o /app/bin/relayer-migrate ./cmd/relayer/migrate && \
CGO_ENABLED=0 go build -o /app/bin/indexer-migrate ./cmd/indexer/migrate && \
CGO_ENABLED=0 go build -o /app/bin/bootstrap-bridge ./scripts/setup/bootstrap-bridge.go && \
CGO_ENABLED=0 go build -o /app/bin/bootstrap-demo ./scripts/setup/bootstrap-demo.go && \
CGO_ENABLED=0 go build -o /app/bin/bootstrap-usdcx ./scripts/setup/bootstrap-usdcx.go && \
CGO_ENABLED=0 go build -o /app/bin/usdcx-registry ./scripts/setup/usdcx-registry.go && \
CGO_ENABLED=0 go build -o /app/bin/register-user ./scripts/testing/register-user.go && \
CGO_ENABLED=0 go build -o /app/bin/mock-oauth2-server ./scripts/utils/mock-oauth2-server.go
# Runtime stage for relayer
FROM alpine:latest AS relayer
WORKDIR /app
RUN apk add --no-cache ca-certificates wget
COPY --from=builder /app/bin/relayer /app/relayer
COPY --from=builder /app/bin/relayer-migrate /app/relayer-migrate
COPY --from=builder /app/pkg/config/defaults /app/config/defaults
COPY scripts/setup/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
ENV DEFAULT_BINARY=/app/relayer
ENV ENV=docker
EXPOSE 8080 9090
ENTRYPOINT ["/app/entrypoint.sh"]
# Runtime stage for mock-oauth2
FROM alpine:latest AS mock-oauth2
WORKDIR /app
RUN apk add --no-cache ca-certificates wget
COPY --from=builder /app/bin/mock-oauth2-server /app/mock-oauth2-server
EXPOSE 8088
ENTRYPOINT ["/app/mock-oauth2-server"]
# Runtime stage for bootstrap tools
FROM alpine:latest AS bootstrap
WORKDIR /app
RUN apk add --no-cache ca-certificates curl jq bash
COPY --from=builder /app/bin/bootstrap-bridge /app/bootstrap-bridge
COPY --from=builder /app/bin/bootstrap-demo /app/bootstrap-demo
COPY --from=builder /app/bin/bootstrap-usdcx /app/bootstrap-usdcx
COPY --from=builder /app/bin/register-user /app/register-user
COPY --from=builder /app/bin/api-server-migrate /app/api-server-migrate
COPY --from=builder /app/bin/relayer-migrate /app/relayer-migrate
COPY --from=builder /app/pkg/config/defaults /app/config/defaults
# Copy the bootstrap script
COPY scripts/setup/docker-bootstrap.sh /app/docker-bootstrap.sh
RUN chmod +x /app/docker-bootstrap.sh
ENV ENV=docker
ENTRYPOINT ["/app/docker-bootstrap.sh"]
# Runtime stage for indexer
FROM alpine:latest AS indexer
WORKDIR /app
RUN apk add --no-cache ca-certificates wget
COPY --from=builder /app/bin/indexer /app/indexer
COPY --from=builder /app/bin/indexer-migrate /app/indexer-migrate
COPY --from=builder /app/pkg/config/defaults /app/config/defaults
COPY scripts/setup/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
ENV DEFAULT_BINARY=/app/indexer
ENV ENV=docker
EXPOSE 8082
ENTRYPOINT ["/app/entrypoint.sh"]
# Runtime stage for usdcx-registry
FROM alpine:latest AS usdcx-registry
WORKDIR /app
RUN apk add --no-cache ca-certificates wget
COPY --from=builder /app/bin/usdcx-registry /app/usdcx-registry
EXPOSE 8090
ENTRYPOINT ["/app/usdcx-registry"]
# Runtime stage for api-server
FROM alpine:latest AS api-server
WORKDIR /app
RUN apk add --no-cache ca-certificates wget
COPY --from=builder /app/bin/api-server /app/api-server
COPY --from=builder /app/bin/api-server-migrate /app/api-server-migrate
COPY --from=builder /app/pkg/config/defaults /app/config/defaults
COPY scripts/setup/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
ENV DEFAULT_BINARY=/app/api-server
ENV ENV=docker
EXPOSE 8081
ENTRYPOINT ["/app/entrypoint.sh"]