Merge pull request #37 from vulcanize/feature-docker-overlay

Update docker environment to support fs overlay
This commit is contained in:
S. R. Wadleigh 2021-10-21 20:19:53 +00:00 committed by GitHub
commit 3d3e68c0ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -6,6 +6,8 @@ RUN apk add busybox-extras
# Get and build ipfs-blockchain-watcher # Get and build ipfs-blockchain-watcher
ADD . /go/src/github.com/vulcanize/eth-statediff-service ADD . /go/src/github.com/vulcanize/eth-statediff-service
#RUN git clone https://github.com/vulcanize/eth-statediff-service.git /go/src/github.com/vulcanize/eth-statediff-service
WORKDIR /go/src/github.com/vulcanize/eth-statediff-service WORKDIR /go/src/github.com/vulcanize/eth-statediff-service
RUN GO111MODULE=on GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o eth-statediff-service . RUN GO111MODULE=on GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o eth-statediff-service .
@ -15,7 +17,10 @@ FROM alpine
ARG USER="vdm" ARG USER="vdm"
ARG CONFIG_FILE="./environments/example.toml" ARG CONFIG_FILE="./environments/example.toml"
ARG EXPOSE_PORT=8545 ARG EXPOSE_PORT=8545
RUN adduser -Du 5000 $USER
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 WORKDIR /app
RUN chown $USER /app RUN chown $USER /app
USER $USER USER $USER

View File

@ -4,8 +4,17 @@ set -e
set +x set +x
# Check the database variables are set # Check the database variables are set
test $VDB_COMMAND test "$VDB_COMMAND"
set +e set +e
echo "Running the statediff service" # docker must be run in privilaged mode for mounts to work
./eth-statediff-service ${VDB_COMMAND} --config=config.toml echo "Setting up /app/geth-rw overlayed /app/geth-ro"
mkdir -p /tmp/overlay && \
sudo mount -t tmpfs tmpfs /tmp/overlay && \
mkdir -p /tmp/overlay/upper && \
mkdir -p /tmp/overlay/work && \
mkdir -p /app/geth-rw && \
sudo mount -t overlay overlay -o lowerdir=/app/geth-ro,upperdir=/tmp/overlay/upper,workdir=/tmp/overlay/work /app/geth-rw && \
echo "Running the statediff service" && \
sudo ./eth-statediff-service "$VDB_COMMAND" --config=config.toml