Browse Source

refactor: lock docker images, normalize mount paths, minor fixes

develop
Apostolos Fanakis 4 years ago
parent
commit
51a365729a
  1. 24
      docker/Makefile
  2. 7
      docker/concordia-app/Dockerfile
  3. 2
      docker/concordia-app/test-app.sh
  4. 2
      docker/concordia-contracts-provider/Dockerfile
  5. 2
      docker/concordia-contracts/Dockerfile
  6. 6
      docker/concordia-contracts/test-contracts.sh
  7. 2
      docker/concordia-pinner/Dockerfile
  8. 2
      docker/docker-compose.yml
  9. 2
      docker/env/contracts-provider.env
  10. 2
      docker/env/pinner.env
  11. 2
      docker/ganache/Dockerfile
  12. 8
      docker/ganache/start-blockchain.sh

24
docker/Makefile

@ -3,8 +3,8 @@ PACKAGES := $(abspath ${CURDIR}/../packages)
REPORTS := $(abspath ${CURDIR}/reports) REPORTS := $(abspath ${CURDIR}/reports)
GANACHE_VOLUMES := $(abspath ${CURDIR}/ganache/volumes) GANACHE_VOLUMES := $(abspath ${CURDIR}/ganache/volumes)
CONTRACTS_PROVIDER_VOLUMES := $(abspath ${CURDIR}/concordia-contracts-provider/volumes) CONTRACTS_PROVIDER_VOLUMES := $(abspath ${CURDIR}/concordia-contracts-provider/volumes)
DOCKER_BUILDKIT = 1
PINNER_VOLUMES := $(abspath ${CURDIR}/concordia-pinner/volumes) PINNER_VOLUMES := $(abspath ${CURDIR}/concordia-pinner/volumes)
DOCKER_BUILDKIT = 1
run: compose-run build-contracts-provider run-contracts-provider build-contracts-migrate run-contracts-migrate build-pinner run-pinner build-app run-app run: compose-run build-contracts-provider run-contracts-provider build-contracts-migrate run-contracts-migrate build-pinner run-pinner build-app run-app
@echo "Concordia is up and running, head over to http://localhost:7777." @echo "Concordia is up and running, head over to http://localhost:7777."
@ -25,7 +25,7 @@ compose-stop-clean-data:
build-ganache: build-ganache:
@docker build ../ -f ./ganache/Dockerfile -t ecentrics/concordia-ganache @docker build ../ -f ./ganache/Dockerfile -t ecentrics/concordia-ganache
run-ganache: run-ganache:
@docker run -d -v ${GANACHE_VOLUMES}/ganache_keys:/home/ganache_keys -p 8545:8545 --env-file=./env/ganache.env --name concordia-ganache --net=concordia_concordia_network ecentrics/concordia-ganache:latest @docker run -d -v ${GANACHE_VOLUMES}/ganache_keys:/mnt/concordia/ganache_keys -p 8545:8545 --env-file=./env/ganache.env --name concordia-ganache --net=concordia_concordia_network ecentrics/concordia-ganache:latest
run-ganache-test: run-ganache-test:
@docker run --rm -d -p 8546:8546 --env-file=./env/ganache.test.env --name concordia-ganache-test --net=concordia_concordia_network ecentrics/concordia-ganache:latest @docker run --rm -d -p 8546:8546 --env-file=./env/ganache.test.env --name concordia-ganache-test --net=concordia_concordia_network ecentrics/concordia-ganache:latest
@ -42,15 +42,15 @@ build-contracts-migrate:
build-contracts-tests: build-contracts-tests:
@docker build ../ -f ./concordia-contracts/Dockerfile --target test -t ecentrics/concordia-contracts-tests --build-arg TZ=Europe/Athens @docker build ../ -f ./concordia-contracts/Dockerfile --target test -t ecentrics/concordia-contracts-tests --build-arg TZ=Europe/Athens
run-contracts-tests: run-contracts-tests:
@docker run --rm -v ${REPORTS}/contracts/:/usr/test-reports/ --env-file=./env/contracts.env --net=concordia_concordia_network ecentrics/concordia-contracts-tests:latest @docker run --rm -v ${REPORTS}/contracts/:/mnt/concordia/test-reports/ --env-file=./env/contracts.env --net=concordia_concordia_network ecentrics/concordia-contracts-tests:latest
run-contracts-tests-host-chain: run-contracts-tests-host-chain:
@docker run --rm -v ${REPORTS}/contracts/:/usr/test-reports/ --env-file=./env/contracts.env --net=host ecentrics/concordia-contracts-tests:latest @docker run --rm -v ${REPORTS}/contracts/:/mnt/concordia/test-reports/ --env-file=./env/contracts.env --net=host ecentrics/concordia-contracts-tests:latest
run-contracts-migrate: run-contracts-migrate:
@docker run --rm -v ${PACKAGES}/concordia-contracts/build/:/usr/src/concordia/packages/concordia-contracts/build/ --env-file=./env/contracts.env --net=concordia_concordia_network ecentrics/concordia-contracts-migrate:latest @docker run --rm -v ${PACKAGES}/concordia-contracts/build/:/usr/src/concordia/packages/concordia-contracts/build/ --env-file=./env/contracts.env --net=concordia_concordia_network ecentrics/concordia-contracts-migrate:latest
run-contracts-migrate-host-chain: run-contracts-migrate-host-chain:
@docker run --rm -v ${PACKAGES}/concordia-contracts/build/:/usr/src/concordia/packages/concordia-contracts/build/ --env-file=./env/contracts.env --net=host ecentrics/concordia-contracts-migrate:latest @docker run --rm -v ${PACKAGES}/concordia-contracts/build/:/usr/src/concordia/packages/concordia-contracts/build/ --env-file=./env/contracts.env --net=host ecentrics/concordia-contracts-migrate:latest
get-contracts: get-contracts:
@docker run --rm -v ${PACKAGES}/concordia-contracts/build/:/build --entrypoint=sh ecentrics/concordia-contracts:latest -c 'cp /usr/src/concordia/packages/concordia-contracts/build/* /build' @docker run --rm -v ${PACKAGES}/concordia-contracts/build/:/mnt/concordia/build --entrypoint=sh ecentrics/concordia-contracts:latest -c 'cp /usr/src/concordia/packages/concordia-contracts/build/* /mnt/concordia/build'
# App targets # App targets
build-app: build-app:
@ -60,7 +60,7 @@ build-app-staging:
build-app-tests: build-app-tests:
@docker build ../ -f ./concordia-app/Dockerfile --target test -t ecentrics/concordia-app-tests --build-arg TZ=Europe/Athens @docker build ../ -f ./concordia-app/Dockerfile --target test -t ecentrics/concordia-app-tests --build-arg TZ=Europe/Athens
run-app-tests: run-app-tests:
@docker run --rm -v ${REPORTS}/app/:/usr/test-reports/ --env-file=./env/concordia.env ecentrics/concordia-app-tests:latest @docker run --rm -v ${REPORTS}/app/:/mnt/concordia/test-reports/ --env-file=./env/concordia.env ecentrics/concordia-app-tests:latest
run-app: run-app:
@docker run -d --env-file=./env/concordia.env -p 7777:80 --name concordia-app ecentrics/concordia-app:latest @docker run -d --env-file=./env/concordia.env -p 7777:80 --name concordia-app ecentrics/concordia-app:latest
run-app-staging: run-app-staging:
@ -72,21 +72,21 @@ run-app-host-chain:
build-contracts-provider: build-contracts-provider:
@docker build ../ -f ./concordia-contracts-provider/Dockerfile -t ecentrics/concordia-contracts-provider --build-arg TZ=Europe/Athens @docker build ../ -f ./concordia-contracts-provider/Dockerfile -t ecentrics/concordia-contracts-provider --build-arg TZ=Europe/Athens
run-contracts-provider-staging: run-contracts-provider-staging:
@docker run -d -v ${CONTRACTS_PROVIDER_VOLUMES}/contracts:/data/contracts --env-file=./env/contracts-provider.env -e NODE_ENV=production -p 8400:8400 --name concordia-contracts-provider --net=concordia_concordia_network ecentrics/concordia-contracts-provider:latest @docker run -d -v ${CONTRACTS_PROVIDER_VOLUMES}/contracts:/mnt/concordia/contracts --env-file=./env/contracts-provider.env -e NODE_ENV=production -p 8400:8400 --name concordia-contracts-provider --net=concordia_concordia_network ecentrics/concordia-contracts-provider:latest
run-contracts-provider: run-contracts-provider:
@docker run -d -v ${CONTRACTS_PROVIDER_VOLUMES}/contracts:/data/contracts --env-file=./env/contracts-provider.env -p 8400:8400 --name concordia-contracts-provider --net=concordia_concordia_network ecentrics/concordia-contracts-provider:latest @docker run -d -v ${CONTRACTS_PROVIDER_VOLUMES}/contracts:/mnt/concordia/contracts --env-file=./env/contracts-provider.env -p 8400:8400 --name concordia-contracts-provider --net=concordia_concordia_network ecentrics/concordia-contracts-provider:latest
# Pinner targets # Pinner targets
build-pinner: build-pinner:
@docker build ../ -f ./concordia-pinner/Dockerfile -t ecentrics/concordia-pinner --build-arg TZ=Europe/Athens @docker build ../ -f ./concordia-pinner/Dockerfile -t ecentrics/concordia-pinner --build-arg TZ=Europe/Athens
run-pinner-staging: run-pinner-staging:
@docker run -d -v ${PINNER_VOLUMES}/orbitdb:/data/orbitdb --env-file=./env/pinner.env -e NODE_ENV=production -p 4444:4444 --name concordia-pinner --net=concordia_concordia_network ecentrics/concordia-pinner:latest @docker run -d -v ${PINNER_VOLUMES}/orbitdb:/mnt/concordia/orbitdb --env-file=./env/pinner.env -e NODE_ENV=production -p 4444:4444 --name concordia-pinner --net=concordia_concordia_network ecentrics/concordia-pinner:latest
run-pinner: run-pinner:
@docker run -d -v ${PINNER_VOLUMES}/orbitdb:/data/orbitdb --env-file=./env/pinner.env -p 4444:4444 --name concordia-pinner --net=concordia_concordia_network ecentrics/concordia-pinner:latest @docker run -d -v ${PINNER_VOLUMES}/orbitdb:/mnt/concordia/orbitdb --env-file=./env/pinner.env -p 4444:4444 --name concordia-pinner --net=concordia_concordia_network ecentrics/concordia-pinner:latest
run-pinner-staging-host: run-pinner-staging-host:
@docker run -d -v ${PINNER_VOLUMES}/orbitdb:/data/orbitdb --env-file=./env/pinner.env -e NODE_ENV=production --net=host --name concordia-pinner ecentrics/concordia-pinner:latest @docker run -d -v ${PINNER_VOLUMES}/orbitdb:/mnt/concordia/orbitdb --env-file=./env/pinner.env -e NODE_ENV=production --net=host --name concordia-pinner ecentrics/concordia-pinner:latest
run-pinner-host: run-pinner-host:
@docker run -d -v ${PINNER_VOLUMES}/orbitdb:/data/orbitdb --env-file=./env/pinner.env --net=host --name concordia-pinner ecentrics/concordia-pinner:latest @docker run -d -v ${PINNER_VOLUMES}/orbitdb:/mnt/concordia/orbitdb --env-file=./env/pinner.env --net=host --name concordia-pinner ecentrics/concordia-pinner:latest
# Other # Other
clean-images: clean-images:

7
docker/concordia-app/Dockerfile

@ -1,7 +1,7 @@
# -------------------------------------------------- # --------------------------------------------------
# Stage 1 (Init application build base) # Stage 1 (Init application build base)
# -------------------------------------------------- # --------------------------------------------------
FROM node:14-buster as base FROM node:14-alpine@sha256:51e341881c2b77e52778921c685e711a186a71b8c6f62ff2edfc6b6950225a2f as base
LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>" LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>"
LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>" LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>"
LABEL gr.thmmy.ecentrics.concordia-image.name="app" LABEL gr.thmmy.ecentrics.concordia-image.name="app"
@ -17,6 +17,9 @@ COPY ./packages/concordia-contracts/package.json ./packages/concordia-contracts/
COPY ./packages/concordia-shared/package.json ./packages/concordia-shared/package.json COPY ./packages/concordia-shared/package.json ./packages/concordia-shared/package.json
COPY ./packages/concordia-app/package.json ./packages/concordia-app/ COPY ./packages/concordia-app/package.json ./packages/concordia-app/
# Install required packages
RUN apk update && apk --no-cache add g++ make python
RUN yarn install --frozen-lockfile RUN yarn install --frozen-lockfile
# Gets the rest of the source code # Gets the rest of the source code
@ -65,7 +68,7 @@ ENTRYPOINT ["yarn", "start"]
# -------------------------------------------------- # --------------------------------------------------
# Stage 4 (Production runtime) # Stage 4 (Production runtime)
# -------------------------------------------------- # --------------------------------------------------
FROM nginx:1.17-alpine as production FROM nginx:1.17-alpine@sha256:01747306a7247dbe928db991eab42e4002118bf636dd85b4ffea05dd907e5b66 as production
LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>" LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>"
LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com" LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com"
LABEL gr.thmmy.ecentrics.concordia-image.name="app" LABEL gr.thmmy.ecentrics.concordia-image.name="app"

2
docker/concordia-app/test-app.sh

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
yarn lint -f html -o /usr/test-reports/concordia-app-eslint.html --no-color yarn lint -f html -o /mnt/concordia/test-reports/concordia-app-eslint.html --no-color
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "TESTS RAN SUCCESSFULLY!" echo "TESTS RAN SUCCESSFULLY!"

2
docker/concordia-contracts-provider/Dockerfile

@ -1,7 +1,7 @@
# -------------------------------------------------- # --------------------------------------------------
# Stage 1 (Runtime) # Stage 1 (Runtime)
# -------------------------------------------------- # --------------------------------------------------
FROM node:14-alpine as runtime FROM node:14-alpine@sha256:51e341881c2b77e52778921c685e711a186a71b8c6f62ff2edfc6b6950225a2f as runtime
LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>" LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>"
LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>" LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>"
LABEL gr.thmmy.ecentrics.concordia-image.name="contracts-provider" LABEL gr.thmmy.ecentrics.concordia-image.name="contracts-provider"

2
docker/concordia-contracts/Dockerfile

@ -1,7 +1,7 @@
# -------------------------------------------------- # --------------------------------------------------
# Stage 1 (Init contracts build base) # Stage 1 (Init contracts build base)
# -------------------------------------------------- # --------------------------------------------------
FROM node:14-alpine as base FROM node:14-alpine@sha256:51e341881c2b77e52778921c685e711a186a71b8c6f62ff2edfc6b6950225a2f as base
LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>" LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>"
LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>" LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>"
LABEL gr.thmmy.ecentrics.concordia-image.name="contracts" LABEL gr.thmmy.ecentrics.concordia-image.name="contracts"

6
docker/concordia-contracts/test-contracts.sh

@ -3,9 +3,9 @@
export CHAIN_HOST="$TEST_CHAIN_HOST" export CHAIN_HOST="$TEST_CHAIN_HOST"
export CHAIN_PORT="$TEST_CHAIN_PORT" export CHAIN_PORT="$TEST_CHAIN_PORT"
yarn _eslint -f html -o /usr/test-reports/concordia-contracts-eslint.html --no-color && yarn _eslint -f html -o /mnt/concordia/test-reports/concordia-contracts-eslint.html --no-color &&
(yarn _solhint >/usr/test-reports/concordia-contracts-solhint.report) && (yarn _solhint >/mnt/concordia/test-reports/concordia-contracts-solhint.report) &&
(yarn test --network env >/usr/test-reports/concordia-contracts-truffle-tests.report) (yarn test --network env >/mnt/concordia/test-reports/concordia-contracts-truffle-tests.report)
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "TESTS RAN SUCCESSFULLY!" echo "TESTS RAN SUCCESSFULLY!"

2
docker/concordia-pinner/Dockerfile

@ -1,7 +1,7 @@
# -------------------------------------------------- # --------------------------------------------------
# Stage 1 (Runtime) # Stage 1 (Runtime)
# -------------------------------------------------- # --------------------------------------------------
FROM node:14-buster as runtime FROM node:14-buster@sha256:32362e2ea89c62d77c86c8f26ad936dbbdc170cd6c06c4d7ff7a809012bb0c32 as runtime
LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>" LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>"
LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>" LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>"
LABEL gr.thmmy.ecentrics.concordia-image.name="pinner" LABEL gr.thmmy.ecentrics.concordia-image.name="pinner"

2
docker/docker-compose.yml

@ -15,7 +15,7 @@ services:
- 8545:8545 - 8545:8545
user: root user: root
volumes: volumes:
- ./ganache/volumes/ganache_keys:/home/ganache_keys - ./ganache/volumes/ganache_keys:/mnt/concordia/ganache_keys
networks: networks:
concordia_network: concordia_network:
restart: always restart: always

2
docker/env/contracts-provider.env

@ -1 +1 @@
UPLOAD_CONTRACTS_DIRECTORY=/data/contracts/ UPLOAD_CONTRACTS_DIRECTORY=/mnt/concordia/contracts/

2
docker/env/pinner.env

@ -1,5 +1,5 @@
USE_EXTERNAL_CONTRACTS_PROVIDER=true USE_EXTERNAL_CONTRACTS_PROVIDER=true
ORBIT_DIRECTORY=/data/orbitdb ORBIT_DIRECTORY=/mnt/concordia/orbitdb
CONTRACTS_PROVIDER_HOST=concordia-contracts-provider CONTRACTS_PROVIDER_HOST=concordia-contracts-provider
CONTRACTS_PROVIDER_PORT=8400 CONTRACTS_PROVIDER_PORT=8400

2
docker/ganache/Dockerfile

@ -1,4 +1,4 @@
FROM trufflesuite/ganache-cli:latest FROM trufflesuite/ganache-cli:v6.12.2@sha256:c062707f17f355872d703cde3de6a12fc45a027ed42857c72514171a5f466ab7
RUN mkdir /home/ganache_db /home/ganache_keys RUN mkdir /home/ganache_db /home/ganache_keys

8
docker/ganache/start-blockchain.sh

@ -14,8 +14,8 @@ if [ -z "${MNEMONIC}" ]; then
--host "$HOST" \ --host "$HOST" \
--port "$PORT" \ --port "$PORT" \
--networkId "$ID" \ --networkId "$ID" \
--account_keys_path "/home/ganache_keys/keys.json" \ --account_keys_path "/mnt/concordia/ganache_keys/keys.json" \
--db "/home/ganache_db/" \ --db "/mnt/concordia/ganache_db/" \
--allowUnlimitedContractSize \ --allowUnlimitedContractSize \
--noVMErrorsOnRPCResponse \ --noVMErrorsOnRPCResponse \
--verbose --verbose
@ -28,8 +28,8 @@ else
--host "$HOST" \ --host "$HOST" \
--port "$PORT" \ --port "$PORT" \
--networkId "$ID" \ --networkId "$ID" \
--account_keys_path "/home/ganache_keys/keys.json" \ --account_keys_path "/mnt/concordia/ganache_keys/keys.json" \
--db "/home/ganache_db/" \ --db "/mnt/concordia/ganache_db/" \
--allowUnlimitedContractSize \ --allowUnlimitedContractSize \
--noVMErrorsOnRPCResponse \ --noVMErrorsOnRPCResponse \
--deterministic \ --deterministic \

Loading…
Cancel
Save