eth-statediff-service/Dockerfile
Roy Crihfield a5125c706c Refactor to use plugeth-statediff (#1)
* Updates to the v5 schema, by delegating to the statediff plugin (as of this branch cerc-io/plugeth-statediff#15), replacing the builder code.
* Adds basic CI workflows
* Updates Docker config and docs, cleans up some things

Reviewed-on: #1
2023-09-28 04:03:59 +00:00

42 lines
1.1 KiB
Docker

FROM golang:1.19-alpine as builder
RUN apk add --no-cache git gcc musl-dev binutils-gold
# DEBUG
RUN apk add busybox-extras
WORKDIR /eth-statediff-service
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 eth-statediff-service .
FROM alpine
ARG USER="vdbm"
ARG EXPOSE_PORT=8545
RUN adduser -Du 5000 $USER adm
RUN adduser $USER adm; apk --no-cache add sudo; echo '%adm ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
WORKDIR /app
RUN chown $USER /app
USER $USER
# chown first so dir is writable
# note: using $USER is merged, but not in the stable release yet
COPY --chown=5000:5000 --from=builder /eth-statediff-service/startup_script.sh .
COPY --chown=5000:5000 --from=builder /eth-statediff-service/environments environments
# keep binaries immutable
COPY --from=builder /eth-statediff-service/eth-statediff-service eth-statediff-service
EXPOSE $EXPOSE_PORT
ENTRYPOINT ["/app/startup_script.sh"]