From 1ba889b101c308c121bfb064bd478d06df627323 Mon Sep 17 00:00:00 2001 From: sven-gerlach Date: Sun, 26 Nov 2023 22:54:44 -0500 Subject: [PATCH] Amend docker setup and add .nvmrc --- .nvmrc | 1 + Dockerfile | 8 ++++++-- README.md | 7 ++++++- docker-compose-dev.yml | 3 ++- package.json | 1 + 5 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..2ab3d4b --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16.20.2 diff --git a/Dockerfile b/Dockerfile index 679118d..97380e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,11 +26,13 @@ COPY . . # template from akhileshns/heroku-deploy # 4) collect the arg inside the Dockerfile and pass the arg onto an ENV var (this must happen before the react build # command as react will include all env vars at build time) -ARG REACT_APP_SESSION_ENCRYPTION_KEY +ARG REACT_APP_CLIENT_HOST ARG REACT_APP_GOOGLE_MAPS_KEY +ARG REACT_APP_SESSION_ENCRYPTION_KEY ARG REACT_APP_STRIPE_API_TEST_KEY -ENV REACT_APP_SESSION_ENCRYPTION_KEY $REACT_APP_SESSION_ENCRYPTION_KEY +ENV REACT_APP_CLIENT_HOST $REACT_APP_CLIENT_HOST ENV REACT_APP_GOOGLE_MAPS_KEY $REACT_APP_GOOGLE_MAPS_KEY +ENV REACT_APP_SESSION_ENCRYPTION_KEY $REACT_APP_SESSION_ENCRYPTION_KEY ENV REACT_APP_STRIPE_API_TEST_KEY $REACT_APP_STRIPE_API_TEST_KEY # make React create build directory (app/build) with production build of the app at container compile-time @@ -46,9 +48,11 @@ FROM nginx # https://hub.docker.com/_/nginx COPY --from=build /app/build /usr/share/nginx/html +ARG REACT_APP_CLIENT_HOST ARG REACT_APP_SESSION_ENCRYPTION_KEY ARG REACT_APP_GOOGLE_MAPS_KEY ARG REACT_APP_STRIPE_API_TEST_KEY +ENV REACT_APP_CLIENT_HOST $REACT_APP_CLIENT_HOST ENV REACT_APP_SESSION_ENCRYPTION_KEY $REACT_APP_SESSION_ENCRYPTION_KEY ENV REACT_APP_GOOGLE_MAPS_KEY $REACT_APP_GOOGLE_MAPS_KEY ENV REACT_APP_STRIPE_API_TEST_KEY $REACT_APP_STRIPE_API_TEST_KEY diff --git a/README.md b/README.md index d0b5f46..58e6d1a 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,12 @@ 6. The app is running on `localhost:3000/` ## Deployment -The app is deployed with AWS Amplify. A CI/CD pipeline has been set up for the main branch such that any change to that branch leads to auto-deployment. + +### Render +The app is deployed on [Render](https://secure-my-spot.sigmagamma.app). A CI/CD pipeline has been set up for the main branch such that any change to that branch leads to auto-deployment. + +### AWS Amplify +The app used to be deployed on AWS Amplify. A CI/CD pipeline has been set up for the main branch such that any change to that branch leads to auto-deployment. > **Note**: environment variables (see above) need to be manually sourced from Doppler and entered into the Amplify platform ## Links diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 295af6c..555d5d1 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -31,10 +31,11 @@ services: # Without this env variable hot-reloading will not work # source: https://mherman.org/blog/dockerizing-a-react-app/ - CHOKIDAR_USEPOLLING="true" + - REACT_APP_CLIENT_HOST=${REACT_APP_CLIENT_HOST} + - REACT_APP_API_HOST=${REACT_APP_API_HOST} - REACT_APP_GOOGLE_MAPS_KEY=${REACT_APP_GOOGLE_MAPS_KEY} - REACT_APP_SESSION_ENCRYPTION_KEY=${REACT_APP_SESSION_ENCRYPTION_KEY} - REACT_APP_STRIPE_API_TEST_KEY=${REACT_APP_STRIPE_API_TEST_KEY} - - REACT_APP_API_HOST=${REACT_APP_API_HOST} # specify bind-mount volume such that any changes in the host's (build-context) src folder are reflected / replicated # inside the container -> amendments to the website are immediately reflected in the container, avoiding the need diff --git a/package.json b/package.json index bccaa5e..eb9f14a 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ }, "scripts": { "start": "react-scripts start", + "start:dev": "doppler run -- npm run start", "build": "react-scripts build", "test": "react-scripts test --watchAll --testMatch **/src/**/*.tests.js", "test:coverage": "CI=true react-scripts test --env=jsdom --coverage --testMatch **/src/**/*.tests.js",