2024-08-05 13:17:00 +00:00
|
|
|
FROM golang:1.21-alpine AS builder
|
2023-05-09 15:33:32 +00:00
|
|
|
|
2023-09-29 18:43:26 +00:00
|
|
|
RUN apk add --no-cache git gcc musl-dev binutils-gold
|
2023-05-09 15:33:32 +00:00
|
|
|
# DEBUG
|
|
|
|
RUN apk add busybox-extras
|
|
|
|
|
2023-09-29 18:43:26 +00:00
|
|
|
WORKDIR /ipld-eth-state-snapshot
|
2023-05-09 15:33:32 +00:00
|
|
|
|
2023-09-29 18:43:26 +00:00
|
|
|
ARG GIT_VDBTO_TOKEN
|
|
|
|
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN if [ -n "$GIT_VDBTO_TOKEN" ]; then git config --global url."https://$GIT_VDBTO_TOKEN:@git.vdb.to/".insteadOf "https://git.vdb.to/"; fi && \
|
|
|
|
go mod download && \
|
|
|
|
rm -f ~/.gitconfig
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
RUN go build -ldflags '-extldflags "-static"' -o ipld-eth-state-snapshot .
|
2023-05-09 15:33:32 +00:00
|
|
|
|
|
|
|
FROM alpine
|
|
|
|
|
|
|
|
RUN apk --no-cache add su-exec bash
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-09-29 18:43:26 +00:00
|
|
|
COPY --from=builder /ipld-eth-state-snapshot/startup_script.sh .
|
|
|
|
COPY --from=builder /ipld-eth-state-snapshot/environments environments
|
2023-05-09 15:33:32 +00:00
|
|
|
|
|
|
|
# keep binaries immutable
|
2023-09-29 18:43:26 +00:00
|
|
|
COPY --from=builder /ipld-eth-state-snapshot/ipld-eth-state-snapshot ipld-eth-state-snapshot
|
2023-05-09 15:33:32 +00:00
|
|
|
|
|
|
|
ENTRYPOINT ["/app/startup_script.sh"]
|