Skip to content

Commit 20d7ce6

Browse files
committed
feat(docker): consolidate seeding into a single init container service
- Replace separate seed (dev) and seed-prod services with one generic seed service using node:22-alpine - Seed runs for both dev and prod profiles as an init container (service_completed_successfully gates downstream services) - Backend and dev services now depend on seed completing before starting - Add seed-node-modules volume to cache dependencies across runs Signed-off-by: Emiliano Suñé <2395873+esune@users.noreply.github.com>
1 parent 515b820 commit 20d7ce6

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

docker-compose.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ services:
7272
MONGODB_URI: mongodb://mongodb:27017/bc_wallet_showcase
7373
KEYCLOAK_INTERNAL_URL: http://keycloak:8080
7474
depends_on:
75-
mongodb:
76-
condition: service_healthy
75+
seed:
76+
condition: service_completed_successfully
7777
dev:
7878
image: bc-wallet-demo-dev
7979
profiles:
@@ -105,24 +105,23 @@ services:
105105
# the URL the browser used when logging in.
106106
KEYCLOAK_INTERNAL_URL: http://keycloak:8080
107107
depends_on:
108-
mongodb:
109-
condition: service_healthy
108+
seed:
109+
condition: service_completed_successfully
110110
keycloak-db:
111111
condition: service_healthy
112112

113113
seed:
114-
image: bc-wallet-demo-dev
114+
image: node:22-alpine
115115
profiles:
116116
- dev
117-
build:
118-
context: ./
119-
dockerfile: ./dev.dockerfile
120-
entrypoint: ['']
121-
command: ['yarn', 'workspace', 'server', 'seed']
117+
- prod
118+
working_dir: /app
119+
entrypoint: ['sh', '-c']
120+
command: ['yarn install --frozen-lockfile --non-interactive && yarn workspace server seed']
122121
restart: on-failure
123122
volumes:
124123
- ./:/app
125-
- dev-node-modules:/app/node_modules
124+
- seed-node-modules:/app/node_modules
126125
env_file:
127126
- path: ./server/.env
128127
required: false
@@ -182,3 +181,4 @@ volumes:
182181
mongo-data:
183182
keycloak-db-data:
184183
dev-node-modules:
184+
seed-node-modules:

0 commit comments

Comments
 (0)