From 56efa7c7f4068ed58f37038c1ddaed6b4ef3f158 Mon Sep 17 00:00:00 2001 From: Francois Zaninotto Date: Tue, 2 Jul 2024 14:47:31 +0200 Subject: [PATCH] Fix docker compose on MacOS (#570) * 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. * Fix formatting --- Dockerfile | 5 +---- compose.yaml | 4 +++- 2 files changed, 4 insertions(+), 5 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..6d0fca25 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,7 +68,7 @@ services: ports: - target: 3000 published: ${PWA_PORT:-3000} - + ###> doctrine/doctrine-bundle ### database: image: postgres:${POSTGRES_VERSION:-15}-alpine @@ -98,3 +99,4 @@ volumes: ###< doctrine/doctrine-bundle ### ###> symfony/mercure-bundle ### ###< symfony/mercure-bundle ### + pwa_node_modules: