Browse Source

Fix dockerfiles, Update Makefile

develop
Apostolos Fanakis 4 years ago
parent
commit
2d3e92d01b
  1. 8
      .dockerignore
  2. 17
      docker/Makefile
  3. 18
      docker/concordia-app/Dockerfile
  4. 2
      docker/concordia-contracts/Dockerfile
  5. 2
      docker/concordia-contracts/migrate.sh

8
.dockerignore

@ -6,13 +6,15 @@ node_modules
docker/
!docker/concordia-contracts/migrate.sh
!docker/concordia-contracts/test-contracts.sh
!docker/concordia-app/test-app.sh
packages/*/node_modules
packages/*/dist
packages/*/coverage
# TO-NEVER-DO: exclude the build *folder* from contracts package, it's needed for building the app the JSON contract
# artifacts can be ignored
packages/concordia-contracts/build/*
# TO-NEVER-DO: exclude the build folder of the contracts package, it's needed for building the application image.
packages/concordia-app/build
Jenkinsfile
README.md
packages/*/README.md

17
docker/Makefile

@ -11,7 +11,7 @@ stop-clean-data:
# Contracts targets
build-contracts:
@docker build ../ -f ./concordia-contracts/Dockerfile --target compile -t concordia-contracts --build-arg TZ=Europe/Athens
build-migrate-contracts:
build-contracts-migrate:
@docker build ../ -f ./concordia-contracts/Dockerfile -t concordia-contracts-migrate --build-arg TZ=Europe/Athens
build-contracts-tests:
@docker build ../ -f ./concordia-contracts/Dockerfile --target test -t concordia-contracts-tests --build-arg TZ=Europe/Athens
@ -20,11 +20,14 @@ run-contract-tests:
run-contract-tests-host-chain:
@docker run --rm -v `pwd`/reports/contracts/:/usr/test-reports/ --env-file=./env/contracts.env --net=host concordia-contracts-tests:latest
run-contracts-migrate:
@docker run --rm --env-file=./env/contracts.env concordia-contracts-migrate:latest
@cd .. &&\
docker run --rm -v `pwd`/packages/concordia-contracts/build/:/usr/src/concordia/packages/concordia-contracts/build/ --env-file=./docker/env/contracts.env concordia-contracts-migrate:latest
run-contracts-migrate-host-chain:
@docker run --rm --env-file=./env/contracts.env --net=host concordia-contracts-migrate:latest
@cd .. &&\
docker run --rm -v `pwd`/packages/concordia-contracts/build/:/usr/src/concordia/packages/concordia-contracts/build/ --env-file=./docker/env/contracts.env --net=host concordia-contracts-migrate:latest
get-contracts:
@cd .. && docker run --rm -v `pwd`/packages/concordia-contracts/build/:/build --entrypoint=sh concordia-contracts:latest -c 'cp /usr/src/concordia/packages/concordia-contracts/build/* /build'
@cd .. && \
docker run --rm -v `pwd`/packages/concordia-contracts/build/:/build --entrypoint=sh concordia-contracts:latest -c 'cp /usr/src/concordia/packages/concordia-contracts/build/* /build'
# App targets
build-app:
@ -32,7 +35,11 @@ build-app:
build-app-tests:
@docker build ../ -f ./concordia-app/Dockerfile --target test -t concordia-app-tests --build-arg TZ=Europe/Athens
run-app-tests:
@docker run --rm -v `pwd`/reports/app/:/usr/test-reports/ --env-file=./env/app.env concordia-app-tests:latest
@docker run --rm -v `pwd`/reports/app/:/usr/test-reports/ --env-file=./env/concordia.env concordia-app-tests:latest
run-app:
@docker run -d --env-file=./env/concordia.env -p 8473:80 --name concordia-app concordia-app:latest
run-app-host-chain:
@docker run -d --env-file=./env/concordia.env --name concordia-app --net=host concordia-app:latest
# Other
clean-images:

18
docker/concordia-app/Dockerfile

@ -1,20 +1,11 @@
# --------------------------------------------------
# Stage 1 (Init contracts build base)
# Stage 1 (Init application build base)
# --------------------------------------------------
FROM node:14-alpine as base
FROM node:14-buster as base
LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>"
LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>"
LABEL gr.thmmy.ecentrics.concordia-image.name="app"
# Fix timezome (needed for timestamps on report files)
ARG TZ
RUN apk add -U tzdata \
&& cp /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& apk del tzdata \
&& rm -rf /var/cache/apk/*
WORKDIR /usr/src/concordia
# Copy the root package.json and yarn.lock
@ -36,6 +27,11 @@ COPY ./packages/concordia-app ./packages/concordia-app
# --------------------------------------------------
FROM base as test
# Fix timezome (needed for timestamps on report files)
ARG TZ
ENV TZ=${TZ}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
WORKDIR /opt/concordia-app
COPY ./docker/concordia-app/test-app.sh .

2
docker/concordia-contracts/Dockerfile

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

2
docker/concordia-contracts/migrate.sh

@ -1,3 +1,3 @@
#!/bin/sh
cd /usr/src/concordia/packages/concordia-contracts && yarn _migrate --network "${MIGRATE_NETWORK}"
cd /usr/src/concordia/packages/concordia-contracts && yarn _migrate --network "${MIGRATE_NETWORK}" --reset

Loading…
Cancel
Save