2023-03-17 17:51:46 +00:00
|
|
|
FROM golang:1.19-alpine as builder
|
2020-08-19 20:30:52 +00:00
|
|
|
|
|
|
|
RUN apk --update --no-cache add make git g++ linux-headers
|
|
|
|
# DEBUG
|
|
|
|
RUN apk add busybox-extras
|
|
|
|
|
|
|
|
# Get and build ipfs-blockchain-watcher
|
2022-09-20 18:00:10 +00:00
|
|
|
ADD . /go/src/github.com/cerc-io/eth-statediff-service
|
|
|
|
#RUN git clone https://github.com/cerc-io/eth-statediff-service.git /go/src/github.com/vulcanize/eth-statediff-service
|
2021-10-21 19:02:22 +00:00
|
|
|
|
2022-09-20 18:00:10 +00:00
|
|
|
WORKDIR /go/src/github.com/cerc-io/eth-statediff-service
|
2020-08-19 20:30:52 +00:00
|
|
|
RUN GO111MODULE=on GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o eth-statediff-service .
|
|
|
|
|
|
|
|
# app container
|
|
|
|
FROM alpine
|
|
|
|
|
2021-10-28 00:57:19 +00:00
|
|
|
ARG CONFIG_FILE="./environments/config.toml"
|
2020-11-09 18:49:33 +00:00
|
|
|
ARG EXPOSE_PORT=8545
|
2021-10-21 19:02:22 +00:00
|
|
|
|
2023-04-29 03:14:45 +00:00
|
|
|
RUN apk --no-cache add su-exec bash
|
2021-10-21 19:02:22 +00:00
|
|
|
|
2020-08-19 20:30:52 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# chown first so dir is writable
|
|
|
|
# note: using $USER is merged, but not in the stable release yet
|
2023-04-29 03:14:45 +00:00
|
|
|
COPY --from=builder /go/src/github.com/cerc-io/eth-statediff-service/$CONFIG_FILE config.toml
|
|
|
|
COPY --from=builder /go/src/github.com/cerc-io/eth-statediff-service/startup_script.sh .
|
|
|
|
COPY --from=builder /go/src/github.com/cerc-io/eth-statediff-service/environments environments
|
2020-08-19 20:30:52 +00:00
|
|
|
|
|
|
|
# keep binaries immutable
|
2022-09-20 18:00:10 +00:00
|
|
|
COPY --from=builder /go/src/github.com/cerc-io/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"]
|