api-platform / admin

A beautiful and fully-featured administration interface builder for hypermedia APIs
https://api-platform.com/docs/admin/
MIT License
477 stars 131 forks source link

Fix docker compose on MacOS #570

Closed fzaninotto closed 2 weeks ago

fzaninotto commented 2 weeks ago

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.

Q A
Branch? main for features / current stable version branch for bug fixes
Tickets Closes #..., closes #...
License MIT
Doc PR api-platform/docs#...
fzaninotto commented 2 weeks ago

It seems my change makes the build fail on Linux for another developer:

Creating volume "api-platform-admin_pwa_node_modules" with default driver
api-platform-admin_database_1 is up-to-date
Recreating api-platform-admin_pwa_1 ... 
Starting 26287da17ab2_api-platform-admin_php_1 ... done

ERROR: for api-platform-admin_pwa_1  'ContainerConfig'

ERROR: for pwa  'ContainerConfig'
Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 81, in main
  File "compose/cli/main.py", line 203, in perform_command
  File "compose/metrics/decorator.py", line 18, in wrapper
  File "compose/cli/main.py", line 1186, in up
  File "compose/cli/main.py", line 1182, in up
  File "compose/project.py", line 702, in up
  File "compose/parallel.py", line 108, in parallel_execute
  File "compose/parallel.py", line 206, in producer
  File "compose/project.py", line 688, in do
  File "compose/service.py", line 581, in execute_convergence_plan
  File "compose/service.py", line 503, in _execute_convergence_recreate
  File "compose/parallel.py", line 108, in parallel_execute
  File "compose/parallel.py", line 206, in producer
  File "compose/service.py", line 496, in recreate
  File "compose/service.py", line 615, in recreate_container
  File "compose/service.py", line 334, in create_container
  File "compose/service.py", line 922, in _get_container_create_options
  File "compose/service.py", line 962, in _build_container_volume_options
  File "compose/service.py", line 1549, in merge_volume_bindings
  File "compose/service.py", line 1579, in get_container_data_volumes
KeyError: 'ContainerConfig'
[1712682] Failed to execute script docker-compose

Docker is NOT portable at all...

I'm currently investigating.