From a9885502d48fa5cd9702be31ea06b6c2951de668 Mon Sep 17 00:00:00 2001 From: Eric Mastro Date: Fri, 28 Apr 2023 16:03:59 +1000 Subject: [PATCH] Add image to CI, and update startCodex.sh --- .github/workflows/docker.yml | 14 ++++++++++++- docker/README.md | 11 +++++++++++ docker/docker-compose.yaml | 38 ++++++++++++++++++------------------ docker/startCodex.sh | 1 + 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d73b81ea..ea178b4c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -38,6 +38,18 @@ jobs: context: . file: docker/codex.Dockerfile platforms: linux/amd64,linux/arm64,linux/arm/v7 - push: ${{ github.event_name != 'pull_request' }} + push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + # Slim it! + - name: Minify docker image + uses: kitabisa/docker-slim-action@v1 + env: + DSLIM_HTTP_PROBE: false + with: + target: ${{ steps.meta.outputs.labels }} + tag: ${{ steps.meta.outputs.tags }} + # Push to the docker registry + - name: Push image to docker registry + run: docker image push "${{ steps.meta.outputs.labels }}:${{ steps.meta.outputs.tags }}" + if: github.event_name != 'pull_request' diff --git a/docker/README.md b/docker/README.md index f09a373f..9befc2ad 100644 --- a/docker/README.md +++ b/docker/README.md @@ -39,6 +39,7 @@ Codex docker image supports the following environment variables: - ETH_PROVIDER - ETH_ACCOUNT - ETH_DEPLOYMENT +- SIMULATE_PROOF_FAILURES (*) These variables have default values in the docker image that are different from Codex's standard default values. @@ -53,3 +54,13 @@ To get the IP address of a container within a network: Find container Id: `docker ps` Open terminal in container: `docker exec -it sh` Get IP addresses: `ifconfig` + +# Slim +1. Build the image using `docker build -t status-im/codexsetup:latest -f codex.Dockerfile ..` +2. The docker image can then be minifed using [slim](https://github.com/slimtoolkit/slim). Install slim on your path and then run: +```shell +slim # brings up interactive prompt +>>> build --target status-im/codexsetup --http-probe-off true +``` +3. This should output an image with name `status-im/codexsetup.slim` +4. We can then bring up the image using `docker-compose up -d`. \ No newline at end of file diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index df1718a1..643682a2 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -4,24 +4,24 @@ services: ports: - 8080:8080 # Available environment variables: - # environment: - # - LOG_LEVEL=TRACE - # - METRICS_ADDR=0.0.0.0 - # - METRICS_PORT=9090 - # - NAT_IP=2.3.4.5 - # - API_PORT=8080 - # - DISC_IP=3.4.5.6 - # - DISC_PORT=8765 - # - NET_PRIVKEY=privkey - # - BOOTSTRAP_SPR=bootstrap_record - # - MAX_PEERS=123 - # - AGENT_STRING=agent_string - # - STORAGE_QUOTA=123456789 - # - BLOCK_TTL=23456 - # - CACHE_SIZE=6543 - # - ETH_PROVIDER=eth - # - ETH_ACCOUNT=account - # - ETH_DEPLOYMENT=deploy - # - SIMULATE_PROOF_FAILURES=0 + environment: + - LOG_LEVEL=TRACE + - METRICS_ADDR=0.0.0.0 + - METRICS_PORT=9090 + - NAT_IP=2.3.4.5 + - API_PORT=8080 + - DISC_IP=3.4.5.6 + - DISC_PORT=8765 + - NET_PRIVKEY=privkey + - BOOTSTRAP_SPR=bootstrap_record + - MAX_PEERS=123 + - AGENT_STRING=agent_string + - STORAGE_QUOTA=123456789 + - BLOCK_TTL=23456 + - CACHE_SIZE=6543 + - ETH_PROVIDER=eth + - ETH_ACCOUNT=account + - ETH_MARKETPLACE_ADDRESS=0x59b670e9fA9D0A427751Af201D676719a970857b + - SIMULATE_PROOF_FAILURES=2 diff --git a/docker/startCodex.sh b/docker/startCodex.sh index c67f7140..b14aed69 100644 --- a/docker/startCodex.sh +++ b/docker/startCodex.sh @@ -122,6 +122,7 @@ if [ -n "$ETH_PROVIDER" ] && [ -n "$ETH_ACCOUNT" ] && [ -n "$ETH_MARKETPLACE_ADD args="$args --eth-deployment=/root/marketplace_address.json" if [ -n "$SIMULATE_PROOF_FAILURES" ]; then + echo "Simulate proof failures: $SIMULATE_PROOF_FAILURES" args="$args --simulate-proof-failures=$SIMULATE_PROOF_FAILURES" fi fi