Skip to content

Commit 4802fa2

Browse files
committed
Add required property to depends_on
1 parent c109913 commit 4802fa2

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/).
99

1010
### Changed
1111

12+
- Add `required: false` to `depends_on` in `docker-compose.yml` (requires Docker Compose v2.20.2+)
13+
1214
#### Back-end dependencies
1315

1416
- Update `cssbundling-rails` to `1.2.0`

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ README.
102102
You'll also need to enable Docker Compose v2 support if you're using Docker
103103
Desktop. On native Linux without Docker Desktop you can [install it as a plugin
104104
to Docker](https://docs.docker.com/compose/install/linux/). It's been generally
105-
available for a while now and very stable. This project uses a specific Docker
106-
Compose profiles feature that only works with Docker Compose v2.
105+
available for a while now and is stable. This project uses specific [Docker
106+
Compose v2
107+
features](https://nickjanetakis.com/blog/optional-depends-on-with-docker-compose-v2-20-2)
108+
that only work with Docker Compose v2 2.20.2+.
107109

108110
If you're using Windows, it will be expected that you're following along inside
109111
of [WSL or WSL

docker-compose.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ x-app: &default-app
88
- "RAILS_ENV=${RAILS_ENV:-production}"
99
- "NODE_ENV=${NODE_ENV:-production}"
1010
depends_on:
11-
- "postgres"
12-
- "redis"
11+
postgres:
12+
condition: "service_started"
13+
required: false
14+
redis:
15+
condition: "service_started"
16+
required: false
1317
env_file:
1418
- ".env"
1519
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"

0 commit comments

Comments
 (0)