diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index a8bfa1c2b..84f77df6c 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -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: . diff --git a/.gitignore b/.gitignore index 4f37d8194..ca2367c8b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,6 @@ upgrade_parameters.json docker/gethData/ *.ignore/ typechain-types/ -create_rollup_parameters.json \ No newline at end of file +create_rollup_parameters.json + +docker/deploymentOutput diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..1bf7bf17f --- /dev/null +++ b/docker/Dockerfile @@ -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"] diff --git a/docker/Dockerfile.geth b/docker/Dockerfile.geth deleted file mode 100644 index 4788debaa..000000000 --- a/docker/Dockerfile.geth +++ /dev/null @@ -1,8 +0,0 @@ -FROM ethereum/client-go:v1.12.0 - -EXPOSE 8545 - -COPY docker/gethData / - -ENTRYPOINT ["geth"] -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"] \ No newline at end of file diff --git a/docker/docker-compose.geth.yml b/docker/docker-compose.yml similarity index 100% rename from docker/docker-compose.geth.yml rename to docker/docker-compose.yml diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 000000000..7a29a3c72 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +set -xeuo + +nginx -g 'daemon off;' & + +geth "$@" diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 000000000..ce924bb55 --- /dev/null +++ b/docker/nginx.conf @@ -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; + } + } +} diff --git a/docker/scripts/v1ToV2/deploy-docker.sh b/docker/scripts/v1ToV2/deploy-docker.sh index 6e9fe02ee..fd3049549 100755 --- a/docker/scripts/v1ToV2/deploy-docker.sh +++ b/docker/scripts/v1ToV2/deploy-docker.sh @@ -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/testV1ToV2/deploy_parameters_docker.json deployment/testV1ToV2/deploy_parameters.json @@ -8,7 +8,7 @@ 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 diff --git a/docker/scripts/v1ToV2/deploy-dockerv2.sh b/docker/scripts/v1ToV2/deploy-dockerv2.sh index 47a15b7a7..edc4ec44a 100755 --- a/docker/scripts/v1ToV2/deploy-dockerv2.sh +++ b/docker/scripts/v1ToV2/deploy-dockerv2.sh @@ -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/testV1ToV2/deploy_parameters_docker.json deployment/testV1ToV2/deploy_parameters.json @@ -8,7 +8,7 @@ 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 \ No newline at end of file diff --git a/docker/scripts/v2/deploy-docker.sh b/docker/scripts/v2/deploy-docker.sh index b7c330d2a..54e679e68 100755 --- a/docker/scripts/v2/deploy-docker.sh +++ b/docker/scripts/v2/deploy-docker.sh @@ -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 @@ -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 diff --git a/docker/scripts/v2/deploy-dockerv2.sh b/docker/scripts/v2/deploy-dockerv2.sh index feabb0a87..75dba6775 100755 --- a/docker/scripts/v2/deploy-dockerv2.sh +++ b/docker/scripts/v2/deploy-dockerv2.sh @@ -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 @@ -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 \ No newline at end of file