Skip to content

Commit

Permalink
Fix docker compose on MacOS
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
fzaninotto committed Jul 1, 2024
1 parent 3ec9691 commit c3e94ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 8 additions & 6 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:

0 comments on commit c3e94ac

Please sign in to comment.