Skip to content

Commit

Permalink
Merge pull request #186 from 0xPolygonHermez/feature/CDK-45
Browse files Browse the repository at this point in the history
Added deployment output files to the image during build
  • Loading branch information
invocamanman authored Feb 7, 2024
2 parents 7e23f88 + 94e723f commit 96c0b72
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: hermeznetwork/geth-zkevm-contracts:1.5-integration
file: docker/Dockerfile.geth
file: docker/Dockerfile
context: .
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ upgrade_parameters.json
docker/gethData/
*.ignore/
typechain-types/
create_rollup_parameters.json
create_rollup_parameters.json

docker/deploymentOutput
19 changes: 19 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ethereum/client-go:v1.12.0

RUN apk update
RUN apk add --no-cache nginx

RUN nginx -v

COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY docker/nginx.conf /etc/nginx/nginx.conf

EXPOSE 8545
EXPOSE 9545

COPY docker/gethData /
COPY docker/deploymentOutput /config/

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

CMD ["--rpc.allow-unprotected-txs", "--http", "--http.addr", "0.0.0.0", "--http.corsdomain", "*", "--http.vhosts", "*", "--ws", "--ws.origins", "*", "--ws.addr", "0.0.0.0", "--dev", "--dev.period", "1", "--datadir", "/geth_data"]
8 changes: 0 additions & 8 deletions docker/Dockerfile.geth

This file was deleted.

File renamed without changes.
7 changes: 7 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env sh

set -xeuo

nginx -g 'daemon off;' &

geth "$@"
35 changes: 35 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;
}

http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

include /etc/nginx/mime.types;
default_type application/json;

server {
listen 9545 default_server;
listen [::]:9545 default_server;

server_name _;
root /config;

location / {
alias /config/;
default_type application/json;
index deploy_output.json;
}
}
}
6 changes: 3 additions & 3 deletions docker/scripts/v1ToV2/deploy-docker.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
sudo rm -rf docker/gethData/geth_data
DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml up -d geth
DEV_PERIOD=1 docker-compose -f docker/docker-compose.yml up -d geth
sleep 5
node docker/scripts/fund-accounts.js
cp docker/scripts/testV1ToV2/deploy_parameters_docker.json deployment/testV1ToV2/deploy_parameters.json
npm run deploy:testnet:testV1ToV2:localhost
mkdir docker/deploymentOutput
mv deployment/testV1ToV2/deploy_output.json docker/deploymentOutput
mv deployment/testV1ToV2/genesis.json docker/deploymentOutput
DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml down
sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth .
DEV_PERIOD=1 docker-compose -f docker/docker-compose.yml down
docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile .
# Let it readable for the multiplatform build coming later!
sudo chmod -R go+rxw docker/gethData
6 changes: 3 additions & 3 deletions docker/scripts/v1ToV2/deploy-dockerv2.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
sudo rm -rf docker/gethData/geth_data
DEV_PERIOD=1 docker compose -f docker/docker-compose.geth.yml up -d geth
DEV_PERIOD=1 docker compose -f docker/docker-compose.yml up -d geth
sleep 5
node docker/scripts/fund-accounts.js
cp docker/scripts/testV1ToV2/deploy_parameters_docker.json deployment/testV1ToV2/deploy_parameters.json
npm run deploy:testnet:testV1ToV2:localhost
mkdir docker/deploymentOutput
mv deployment/testV1ToV2/deploy_output.json docker/deploymentOutput
mv deployment/testV1ToV2/genesis.json docker/deploymentOutput
DEV_PERIOD=1 docker compose -f docker/docker-compose.geth.yml down
sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth .
DEV_PERIOD=1 docker compose -f docker/docker-compose.yml down
docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile .
# Let it readable for the multiplatform build coming later!
sudo chmod -R go+rxw docker/gethData
6 changes: 3 additions & 3 deletions docker/scripts/v2/deploy-docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
sudo rm -rf docker/gethData/geth_data
DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml up -d geth
DEV_PERIOD=1 docker-compose -f docker/docker-compose.yml up -d geth
sleep 5
node docker/scripts/fund-accounts.js
cp docker/scripts/v2/deploy_parameters_docker.json deployment/v2/deploy_parameters.json
Expand All @@ -10,7 +10,7 @@ mkdir docker/deploymentOutput
mv deployment/v2/deploy_output.json docker/deploymentOutput
mv deployment/v2/genesis.json docker/deploymentOutput
mv deployment/v2/create_rollup_output.json docker/deploymentOutput
DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml down
sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth .
DEV_PERIOD=1 docker-compose -f docker/docker-compose.yml down
docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile .
# Let it readable for the multiplatform build coming later!
sudo chmod -R go+rxw docker/gethData
6 changes: 3 additions & 3 deletions docker/scripts/v2/deploy-dockerv2.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
sudo rm -rf docker/gethData/geth_data
DEV_PERIOD=1 docker compose -f docker/docker-compose.geth.yml up -d geth
DEV_PERIOD=1 docker compose -f docker/docker-compose.yml up -d geth
sleep 5
node docker/scripts/fund-accounts.js
cp docker/scripts/v2/deploy_parameters_docker.json deployment/v2/deploy_parameters.json
Expand All @@ -10,7 +10,7 @@ mkdir docker/deploymentOutput
mv deployment/v2/deploy_output.json docker/deploymentOutput
mv deployment/v2/genesis.json docker/deploymentOutput
mv deployment/v2/create_rollup_output.json docker/deploymentOutput
DEV_PERIOD=1 docker compose -f docker/docker-compose.geth.yml down
sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth .
DEV_PERIOD=1 docker compose -f docker/docker-compose.yml down
docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile .
# Let it readable for the multiplatform build coming later!
sudo chmod -R go+rxw docker/gethData

0 comments on commit 96c0b72

Please sign in to comment.