From c3e94acf23ca463f2dbfebb4f9c75b2eb49529db Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Mon, 1 Jul 2024 18:02:16 +0200 Subject: [PATCH 1/2] Fix docker compose on MacOS ## Problem When calling `docker compose up`, the `pwa` service fails with a strange error on MacOS: ``` pwa-1 | yarn run v1.22.22 pwa-1 | $ storybook dev -p 3000 pwa-1 | /bin/sh: 1: storybook: not found pwa-1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. pwa-1 | error Command failed with exit code 127. ``` It seems the container doesn't find the node_modules at all. ## Solution Add a second volume for the node_modules. --- Dockerfile | 5 +---- compose.yaml | 14 ++++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0786a799..9f8cc688 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,14 +20,11 @@ ENV PORT 3000 COPY --link package.json yarn.lock .yarnrc.yml ./ RUN set -eux; \ - yarn && yarn cache clean + yarn && yarn playwright install --with-deps && yarn cache clean # copy sources COPY --link . ./ -RUN set -eux; \ - yarn playwright install --with-deps && yarn cache clean - # Development image FROM base as dev diff --git a/compose.yaml b/compose.yaml index 4941759a..b7311b5c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -58,6 +58,7 @@ services: ENTRYPOINT: ${ENTRYPOINT:-https://localhost} volumes: - .:/srv/app + - pwa_node_modules:/srv/app/node_modules healthcheck: test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"] interval: 10s @@ -67,8 +68,8 @@ services: ports: - target: 3000 published: ${PWA_PORT:-3000} - -###> doctrine/doctrine-bundle ### + + ###> doctrine/doctrine-bundle ### database: image: postgres:${POSTGRES_VERSION:-15}-alpine environment: @@ -93,8 +94,9 @@ services: volumes: caddy_data: caddy_config: -###> doctrine/doctrine-bundle ### + ###> doctrine/doctrine-bundle ### db_data: -###< doctrine/doctrine-bundle ### -###> symfony/mercure-bundle ### -###< symfony/mercure-bundle ### + ###< doctrine/doctrine-bundle ### + ###> symfony/mercure-bundle ### + ###< symfony/mercure-bundle ### + pwa_node_modules: From 0a19fbfe9ec4369b01ac4bdaa02a1d72426b1b23 Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Mon, 1 Jul 2024 18:04:50 +0200 Subject: [PATCH 2/2] Fix formatting --- compose.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compose.yaml b/compose.yaml index b7311b5c..6d0fca25 100644 --- a/compose.yaml +++ b/compose.yaml @@ -69,7 +69,7 @@ services: - target: 3000 published: ${PWA_PORT:-3000} - ###> doctrine/doctrine-bundle ### +###> doctrine/doctrine-bundle ### database: image: postgres:${POSTGRES_VERSION:-15}-alpine environment: @@ -94,9 +94,9 @@ services: volumes: caddy_data: caddy_config: - ###> doctrine/doctrine-bundle ### +###> doctrine/doctrine-bundle ### db_data: - ###< doctrine/doctrine-bundle ### - ###> symfony/mercure-bundle ### - ###< symfony/mercure-bundle ### +###< doctrine/doctrine-bundle ### +###> symfony/mercure-bundle ### +###< symfony/mercure-bundle ### pwa_node_modules: