diff --git a/.gitignore b/.gitignore index 9a3b513..dcddbe1 100755 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ yarn-error.log* # Docker volumes docker/volumes docker/ganache/volumes +docker/concordia-contracts-provider/volumes docker/reports # Misc diff --git a/docker/Makefile b/docker/Makefile index 2a746a5..1ee3d8f 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -2,6 +2,7 @@ PACKAGES := $(abspath ${CURDIR}/../packages) REPORTS := $(abspath ${CURDIR}/reports) GANACHE_VOLUMES := $(abspath ${CURDIR}/ganache/volumes) +CONTRACTS_PROVIDER_VOLUMES := $(abspath ${CURDIR}/concordia-contracts-provider/volumes) DOCKER_BUILDKIT = 1 run: compose-run build-contracts-migrate run-contracts-migrate build-app run-app @@ -72,6 +73,14 @@ run-app-staging: run-app-host-chain: @docker run -d --env-file=./env/concordia.env --name concordia-app --net=host ecentrics/concordia-app:latest +# Contracts provider targets +build-contracts-provider: + @docker build ../ -f ./concordia-contracts-provider/Dockerfile -t ecentrics/concordia-contracts-provider --build-arg TZ=Europe/Athens +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 ecentrics/concordia-contracts-provider:latest +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 ecentrics/concordia-contracts-provider:latest + # Other clean-images: @docker rmi `docker images -q -f "dangling=true"` diff --git a/docker/concordia-contracts-provider/Dockerfile b/docker/concordia-contracts-provider/Dockerfile new file mode 100644 index 0000000..452a69d --- /dev/null +++ b/docker/concordia-contracts-provider/Dockerfile @@ -0,0 +1,34 @@ +# -------------------------------------------------- +# Stage 1 (Runtime) +# -------------------------------------------------- +FROM node:14-alpine as runtime +LABEL maintainers.1="Apostolos Fanakis " +LABEL maintainers.2="Panagiotis Nikolaidis " +LABEL gr.thmmy.ecentrics.concordia-image.name="contracts-provider" + +# 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 +COPY ./package.json . +COPY ./yarn.lock . + +# Copy the contracts provider package.json, then install modules +COPY ./packages/concordia-contracts-provider/package.json ./packages/concordia-contracts-provider/ + +RUN yarn install --frozen-lockfile --network-timeout 100000 + +# Gets the rest of the source code +COPY ./packages/concordia-contracts-provider ./packages/concordia-contracts-provider + +WORKDIR /usr/src/concordia/packages/concordia-contracts-provider + +ENTRYPOINT ["yarn", "start"] \ No newline at end of file diff --git a/docker/env/contracts-provider.env b/docker/env/contracts-provider.env new file mode 100644 index 0000000..6903a65 --- /dev/null +++ b/docker/env/contracts-provider.env @@ -0,0 +1 @@ +UPLOAD_CONTRACTS_DIRECTORY=/data/contracts/