codex-storage / codex-contracts-eth

Ethereum smart contracts for Codex
Other
6 stars 9 forks source link

Add Docker builds #56

Closed veaceslavdoina closed 1 year ago

veaceslavdoina commented 1 year ago

This is a follow up of the https://github.com/codex-storage/nim-codex/issues/412 and we added automated Docker builds.

Some information about performed experiments, because resulted image size is not so small

Stage Image Build, m Push, m Total, m Size, MB
Single-stage slim amd64 02:08 00:08 03:14 250.99
slim arm64 02:24 345.89
alpine amd64 02:12 00:08 02:43 225.26
alpine arm64 01:57 320.52
Milti-stage slim amd64 01:56 00:07 02:44 162.20
slim arm64 02:19 162.43
alpine amd64 02:15 00:09 02:44 136.49
alpine arm64 01:53 136.99

We chose the slim one, as a smallest officially supported - Choosing the best Node.js Docker image. Also multi-stage builds provides a smaller size.

Images are published under Codex organization repository - codexstorage/codex-contracts-eth

Now, we use same approach as for nim-codex

# On commit
sha-0a20b12
sha-0a20b12-linux-arm64
sha-0a20b12-linux-amd64

# On tag
latest
0.0.1
0.0.1-linux-arm64
0.0.1-linux-amd64

Usage

# Run
docker run \
  --rm \
  --name codex-contracts-eth \
  codexstorage/codex-contracts-eth:sha-0a20b12

# Publish port
docker run \
  --rm \
  --publish 8545:8545 \
  --name codex-contracts-eth \
  codexstorage/codex-contracts-eth:sha-0a20b12

# Check enpoint
curl localhost:8545 \
  --request POST \
  --silent \
  --data '{"jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params":["latest", false], "id": 1}' | \
  jq -r