Skip to content

Commit

Permalink
build: bash shell for production docker builds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eatyourgreens committed Nov 14, 2024
1 parent 958e806 commit cf7f63f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 15 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -46,6 +58,3 @@ services:
- PORT=3000
ports:
- "3003:3000"

volumes:
node_modules:
2 changes: 1 addition & 1 deletion packages/app-root/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cf7f63f

Please sign in to comment.