From adc5ed324da6b3678145a9ef3f850fa0bad9be10 Mon Sep 17 00:00:00 2001 From: sellnat77 Date: Tue, 7 Apr 2020 17:21:33 -0700 Subject: [PATCH] Updated docker compose example and fixed dockerfile for frontend --- Dockerfile | 5 +++-- Orchestration/docker-compose-example.yml | 18 +++++++++++++----- copyEnv.sh | 5 +++++ 3 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 copyEnv.sh diff --git a/Dockerfile b/Dockerfile index 832d96859..8365ee4d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,9 +7,10 @@ RUN npm config set registry http://registry.npmjs.org/ && npm install --silent WORKDIR /usr/src/app COPY . /usr/src/app/ RUN cp -a /tmp/node_modules /usr/src/app/ -RUN webpack +#RUN webpack ENV NODE_ENV=production ENV PORT=3000 +ENV REACT_APP_MAPBOX_TOKEN=REDACTED RUN ls -CMD [ "node", "server.js" ] +CMD [ "sh", "copyEnv.sh"] EXPOSE 3000 diff --git a/Orchestration/docker-compose-example.yml b/Orchestration/docker-compose-example.yml index 6dd790d14..8d740d56a 100644 --- a/Orchestration/docker-compose-example.yml +++ b/Orchestration/docker-compose-example.yml @@ -1,23 +1,31 @@ -version: '3.1' +version: '3.4' services: backend: - build: - context: ../server - image: docker.pkg.github.com/hackforla/311-data/backend:0.0.1 + # build: + # context: ../server + image: docker.pkg.github.com/hackforla/311-data/backend:efdd561e412d78a9a97a074abdb3b73f28e108ce restart: always container_name: "311-backend" environment: DB_CONNECTION_STRING: postgresql://REDACTED:REDACTED@db:5432/postgres + PROJECT_URL: REDACTED + GITHUB_TOKEN: REDACTED + TOKEN: REDACTED ports: - 5000:5000 frontend: build: context: .. - image: docker.pkg.github.com/hackforla/311-data/frontend:0.0.1 + network_mode: host + image: docker.pkg.github.com/hackforla/311-data/frontend:efdd561e412d78a9a97a074abdb3b73f28e108ce restart: always container_name: "311-frontend" + environment: + REACT_APP_MAPBOX_TOKEN: REDACTED + DB_URL: http://localhost:5000 + BASE_URL: '' ports: - 3000:3000 diff --git a/copyEnv.sh b/copyEnv.sh new file mode 100644 index 000000000..c0c797350 --- /dev/null +++ b/copyEnv.sh @@ -0,0 +1,5 @@ +echo REACT_APP_MAPBOX_TOKEN=$REACT_APP_MAPBOX_TOKEN > .env +echo DB_URL=$DB_URL >> .env +echo BASE_URL=$BASE_URL >> .env +webpack +node server.js