eth-statediff-service/Dockerfile

38 lines
929 B
Docker
Raw Normal View History

FROM golang:1.19-alpine as builder
2020-08-19 20:30:52 +00:00
RUN apk add --no-cache git gcc musl-dev binutils-gold
2020-08-19 20:30:52 +00:00
# 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 .
2020-08-19 20:30:52 +00:00
FROM alpine
ARG USER="vdbm"
2020-11-09 18:49:33 +00:00
ARG EXPOSE_PORT=8545
ARG CONFIG_FILE="./environments/docker.toml"
RUN apk --no-cache add su-exec bash
2020-08-19 20:30:52 +00:00
WORKDIR /app
COPY --from=builder /eth-statediff-service/$CONFIG_FILE config.toml
COPY --from=builder /eth-statediff-service/startup_script.sh .
2020-08-19 20:30:52 +00:00
# keep binaries immutable
COPY --from=builder /eth-statediff-service/eth-statediff-service eth-statediff-service
2020-08-19 20:30:52 +00:00
EXPOSE $EXPOSE_PORT
ENTRYPOINT ["/app/startup_script.sh"]