Browse Source

Merge branch 'feature/114-dockerize-pinner' into 'develop'

feat: dockerize pinner application

See merge request ecentrics/concordia!15
develop
Apostolos Fanakis 4 years ago
parent
commit
d2589f5695
  1. 13
      docker/Makefile
  2. 34
      docker/concordia-pinner/Dockerfile
  3. 16
      docker/env/pinner.env

13
docker/Makefile

@ -1,6 +1,7 @@
PACKAGES := $(abspath ${CURDIR}/../packages)
REPORTS := $(abspath ${CURDIR}/reports)
GANACHE_VOLUMES := $(abspath ${CURDIR}/ganache/volumes)
PINNER_VOLUMES := $(abspath ${CURDIR}/pinner/volumes)
run: compose-run build-contracts-migrate run-contracts-migrate build-app run-app
@echo "Concordia is up and running, head over to http://localhost:7777."
@ -62,6 +63,18 @@ run-app:
run-app-host-chain:
@docker run -d --env-file=./env/concordia.env --name concordia-app --net=host concordia-app:latest
# Contracts provider targets
build-pinner:
@docker build ../ -f ./concordia-pinner/Dockerfile -t ecentrics/concordia-pinner --build-arg TZ=Europe/Athens
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 ecentrics/concordia-pinner:latest
run-pinner:
@docker run -d -v ${PINNER_VOLUMES}/orbitdb:/data/orbitdb --env-file=./env/pinner.env -p 4444:4444 --name concordia-pinner ecentrics/concordia-pinner:latest
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
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
# Other
clean-images:
@docker rmi `docker images -q -f "dangling=true"`

34
docker/concordia-pinner/Dockerfile

@ -0,0 +1,34 @@
# --------------------------------------------------
# Stage 1 (Runtime)
# --------------------------------------------------
FROM node:14-buster as runtime
LABEL maintainers.1="Apostolos Fanakis <apostolof@auth.gr>"
LABEL maintainers.2="Panagiotis Nikolaidis <ezerous@gmail.com>"
LABEL gr.thmmy.ecentrics.concordia-image.name="pinner"
# 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 /usr/src/concordia
# Copy the root package.json and yarn.lock
COPY ./package.json .
COPY ./yarn.lock .
# Copy the pinner, contracts and shared package.json files, then install modules
COPY ./packages/concordia-pinner/package.json ./packages/concordia-pinner/
COPY ./packages/concordia-contracts/package.json ./packages/concordia-contracts/
COPY ./packages/concordia-shared/package.json ./packages/concordia-shared/
RUN yarn install --frozen-lockfile --network-timeout 100000
# Gets the rest of the source code
COPY ./packages/concordia-shared ./packages/concordia-shared
COPY ./packages/concordia-contracts ./packages/concordia-contracts
COPY ./packages/concordia-pinner ./packages/concordia-pinner
WORKDIR /usr/src/concordia/packages/concordia-pinner
ENTRYPOINT ["yarn", "start"]

16
docker/env/pinner.env

@ -0,0 +1,16 @@
USE_EXTERNAL_CONTRACTS_PROVIDER=true
ORBIT_DIRECTORY=/data/orbitdb
#CONTRACTS_PROVIDER_HOST=contracts-provider
CONTRACTS_PROVIDER_HOST=127.0.0.1
CONTRACTS_PROVIDER_PORT=8400
CONTRACTS_VERSION_HASH=latest
PINNER_API_HOST=127.0.0.1
PINNER_API_PORT=4444
RENDEZVOUS_HOST=127.0.0.1
RENDEZVOUS_PORT=9090
WEB3_HOST=127.0.0.1
WEB3_PORT=8545
Loading…
Cancel
Save