Skip to content

Commit

Permalink
Merge pull request #37 from vulcanize/feature-docker-overlay
Browse files Browse the repository at this point in the history
Update docker environment to support fs overlay
  • Loading branch information
srwadleigh authored Oct 21, 2021
2 parents a057940 + 66835c4 commit 3d3e68c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ RUN apk add busybox-extras

# Get and build ipfs-blockchain-watcher
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
RUN GO111MODULE=on GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o eth-statediff-service .

Expand All @@ -15,7 +17,10 @@ FROM alpine
ARG USER="vdm"
ARG CONFIG_FILE="./environments/example.toml"
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
RUN chown $USER /app
USER $USER
Expand Down
15 changes: 12 additions & 3 deletions startup_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ set -e
set +x

# Check the database variables are set
test $VDB_COMMAND
test "$VDB_COMMAND"
set +e

echo "Running the statediff service"
./eth-statediff-service ${VDB_COMMAND} --config=config.toml
# docker must be run in privilaged mode for mounts to work
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

0 comments on commit 3d3e68c

Please sign in to comment.