From cf7f63f1227b1feab07f8193a8169e3d19070104 Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Thu, 14 Nov 2024 22:38:07 +0000 Subject: [PATCH] build: bash shell for production docker builds This adds a bash shell for production docker builds, and renames the previous `shell` service to `dev-shell`. I've also removed the `node_modules` volume, so that `node_modules` in each image is installed by Yarn and not mounted from your local machine. --- README.md | 6 ++++-- docker-compose.yml | 21 +++++++++++++++------ packages/app-root/README.md | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4e67b60073c..a26aa7fde70 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,10 @@ docker compose build docker compose up -d # shut down the running containers when you're finished docker compose down -# run this if you need a shell inside the running container -docker compose run --rm shell +# run this if you need a shell inside the dev container +docker compose run --rm dev-shell +# run this for a shell inside the production container +docker compose run --rm prod-shell ``` You can supply a service name (from `docker-compose.yml`) to `docker compose` if you only want to run a single service eg. diff --git a/docker-compose.yml b/docker-compose.yml index 215299ca0da..6d17f7ab23c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,24 @@ services: - shell: + prod-shell: + image: front-end-monorepo_prod:latest + build: + context: ./ + args: + - NODE_ENV=production + - PANOPTES_ENV=production + - NEXT_TELEMETRY_DISABLED=1 + - APP_ENV=development + command: + - "/bin/sh" + dev-shell: image: front-end-monorepo_dev:latest - volumes: - - node_modules:/usr/src/node_modules build: context: ./ target: builder args: + - NODE_ENV=production + - PANOPTES_ENV=production + - NEXT_TELEMETRY_DISABLED=1 - APP_ENV=development command: - "/bin/sh" @@ -46,6 +58,3 @@ services: - PORT=3000 ports: - "3003:3000" - -volumes: - node_modules: diff --git a/packages/app-root/README.md b/packages/app-root/README.md index 116ce6cace4..ad78c127d76 100644 --- a/packages/app-root/README.md +++ b/packages/app-root/README.md @@ -27,7 +27,7 @@ docker compose up -d # stop the local services when you're finished docker compose down # run the tests -docker compose run --rm project test +docker compose run --rm root test ``` ### Node