docker
This commit is contained in:
parent
958e64d33f
commit
90cd071d15
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@ -0,0 +1,32 @@
|
||||
FROM golang:1.13-alpine as builder
|
||||
|
||||
RUN apk --update --no-cache add make git g++ linux-headers
|
||||
# DEBUG
|
||||
RUN apk add busybox-extras
|
||||
|
||||
# Get and build tx_spammer
|
||||
ADD . /go/src/github.com/vulcanize/tx_spammer
|
||||
WORKDIR /go/src/github.com/vulcanize/tx_spammer
|
||||
RUN GO111MODULE=on GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o tx_spammer .
|
||||
|
||||
# app container
|
||||
FROM alpine
|
||||
|
||||
ARG USER="vdm"
|
||||
ARG CONFIG_FILE="./environments/example.toml"
|
||||
|
||||
RUN adduser -Du 5000 $USER
|
||||
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 /go/src/github.com/vulcanize/tx_spammer/$CONFIG_FILE config.toml
|
||||
COPY --chown=5000:5000 --from=builder /go/src/github.com/vulcanize/tx_spammer/startup_script.sh .
|
||||
|
||||
# keep binaries immutable
|
||||
COPY --from=builder /go/src/github.com/vulcanize/tx_spammer/tx_spammer tx_spammer
|
||||
COPY --from=builder /go/src/github.com/vulcanize/tx_spammer/environments environments
|
||||
|
||||
ENTRYPOINT ["/app/startup_script.sh"]
|
16
startup_script.sh
Normal file
16
startup_script.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set +x
|
||||
test $SPAMMER_COMMAND
|
||||
set +e
|
||||
|
||||
echo "Running tx spammer"
|
||||
./ipld-eth-indexer ${SPAMMER_COMMAND} --config=config.toml --log-file=${LOG_FILE} --log-level=${LOG_LEVEL}
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "tx spammer ran successfully"
|
||||
else
|
||||
echo "tx spammer ran with error. Is the config file correct?"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue
Block a user