Skip to content

Commit

Permalink
Merge pull request #89 from elopez/docker-improvements
Browse files Browse the repository at this point in the history
Docker container improvements
  • Loading branch information
anishnaik authored Jul 6, 2022
2 parents caa6758 + 73cccc8 commit 12f5c0e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 78 deletions.
35 changes: 22 additions & 13 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish Docker
on:
push:
branches: [master]
branches: [master, docker-improvements]
tags:
- '*'
jobs:
Expand All @@ -10,16 +10,21 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: GitHub Login
uses: azure/docker-login@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
id: buildx
with:
login-server: docker.pkg.github.com
install: true

- name: GitHub Container Registry Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set Docker Package and Version
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
id: version
run: |
set +e
_=$(echo "$GITHUB_REF" | grep "^refs/heads/")
Expand All @@ -41,20 +46,24 @@ jobs:
PKG=etheno
fi
set -e
echo "::set-env name=PKG::$PKG"
echo "::set-env name=VER::$VER"
echo "::set-output name=PKG::$PKG"
echo "::set-output name=VER::$VER"
- name: Docker Build
run: docker build -t $PKG:$VER .
run: docker build -t ${{ steps.version.outputs.PKG }}:${{ steps.version.outputs.VER }} --load --target final .

- name: Docker Push
run: |
docker tag ${{ steps.version.outputs.PKG }}:${{ steps.version.outputs.VER }} ghcr.io/${{ github.repository }}/${{ steps.version.outputs.PKG }}:${{ steps.version.outputs.VER }}
docker push ghcr.io/${{ github.repository }}/${{ steps.version.outputs.PKG }}:${{ steps.version.outputs.VER }}
- name: DockerHub Login
uses: azure/docker-login@v1
uses: docker/login-action@v1
with:
login-server: registry.hub.docker.com
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}

- name: Docker Push
run: |
docker tag $PKG:$VER registry.hub.docker.com/trailofbits/$PKG:$VER
docker push registry.hub.docker.com/trailofbits/$PKG:$VER
docker tag ${{ steps.version.outputs.PKG }}:${{ steps.version.outputs.VER }} registry.hub.docker.com/trailofbits/${{ steps.version.outputs.PKG }}:${{ steps.version.outputs.VER }}
docker push registry.hub.docker.com/trailofbits/${{ steps.version.outputs.PKG }}:${{ steps.version.outputs.VER }}
69 changes: 33 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,59 @@
FROM ubuntu:bionic
MAINTAINER Evan Sultanik
# syntax=docker/dockerfile:1.3
FROM ubuntu:focal AS python-wheels
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
cmake \
python3-dev \
python3-pip \
python3-setuptools
RUN --mount=type=bind,target=/etheno \
cd /etheno && \
pip3 wheel --no-cache-dir -w /wheels '.[manticore]'

RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \

FROM ubuntu:focal AS final
LABEL org.opencontainers.image.authors="Evan Sultanik"

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
bash-completion \
sudo \
ca-certificates \
curl \
gpg-agent \
libudev-dev \
locales \
python3 \
libpython3-dev \
python3-pip \
python3-setuptools \
git \
build-essential \
software-properties-common \
locales-all locales \
libudev-dev \
gpg-agent \
&& apt-get clean \
sudo \
&& rm -rf /var/lib/apt/lists/*

RUN DEBIAN_FRONTEND=noninteractive add-apt-repository -y ppa:ethereum/ethereum && \
RUN add-apt-repository -y ppa:ethereum/ethereum && \
apt-get update && apt-get install -y --no-install-recommends \
solc \
ethereum \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - && sudo apt-get install -y --no-install-recommends nodejs && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && \
sudo apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*

# TODO: need to check whether this installation is correct
RUN npm install --production -g ganache truffle && npm --force cache clean

RUN useradd -m etheno
RUN usermod -aG sudo etheno
USER etheno
WORKDIR /home/etheno
USER root
WORKDIR /root
# BEGIN Install Etheno
RUN --mount=type=bind,target=/mnt/etheno \
--mount=type=bind,target=/mnt/wheels,source=/wheels,from=python-wheels \
cd /mnt/etheno && \
pip3 install --no-cache-dir --no-index --find-links /mnt/wheels '.[manticore]'

# Install Parity
RUN curl https://get.parity.io -L | bash
RUN useradd -m -G sudo etheno

# Allow passwordless sudo for etheno
RUN echo 'etheno ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers

USER etheno
ENV HOME=/home/etheno PATH=$PATH:/home/etheno/.local/bin
ENV HOME=/home/etheno
WORKDIR /home/etheno

COPY --chown=etheno:etheno LICENSE setup.py etheno/
COPY --chown=etheno:etheno etheno/*.py etheno/etheno/

RUN cd etheno && \
pip3 install --no-cache-dir && \
cd .. && \
rm -rf etheno

COPY --chown=etheno:etheno examples examples/

CMD ["/bin/bash"]
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ etheno --ganache
* `--balance` or `-b` sets the default balance (in Ether) to seed to each Ganache account (default is 100.0)
* `--gas-price` or `-c` sets the default gas price for Ganache (default is 20000000000)

**NOTE**: As of September, 2020, there is
[an upstream bug in `ganache-cli` that prevents it from being run on Node version 14](https://github.com/trufflesuite/ganache-cli/issues/732).
If you intend to use Truffle and/or Ganache, we suggest using Node 12 (_e.g._,
with [`nvm`](https://github.com/nvm-sh/nvm)).

### Differential Testing

Whenever two or more clients are run within Etheno, the differential
Expand Down
24 changes: 0 additions & 24 deletions docker/install-libff.sh

This file was deleted.

0 comments on commit 12f5c0e

Please sign in to comment.