docker-compose.yml 2,85 ko
Newer Older
version: '3.4'
x-cache-from:
  - &api-cache-from
    cache_from:
      - ${NGINX_IMAGE:-quay.io/api-platform/nginx}
      - ${PHP_IMAGE:-quay.io/api-platform/php}
  php:
    build:
      context: ./api
      target: api_platform_php
      <<: *api-cache-from
    image: ${PHP_IMAGE:-quay.io/api-platform/php}
    depends_on:
      - db
    volumes:
      - ./api:/srv/api:rw,cached
      # if you develop on Linux, you may use a bind-mounted host directory instead
      # - ./api/var:/srv/api/var:rw
  api:
    build:
      context: ./api
      target: api_platform_nginx
      <<: *api-cache-from
    image: ${NGINX_IMAGE:-quay.io/api-platform/nginx}
    depends_on:
      - php
    volumes:
      - ./api/public:/srv/api/public:ro
    ports:
      - target: 80
        published: 8080
        protocol: tcp
Silas Albrecht's avatar
Silas Albrecht a validé
    image: postgres:10-alpine
    environment:
      - POSTGRES_DB=api
      - POSTGRES_PASSWORD=!ChangeMe!
      - POSTGRES_USER=api-platform
    volumes:
      - db-data:/var/lib/postgresql/data:rw
      # you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
      # - ./api/docker/db/data:/var/lib/postgresql/data:rw
      - target: 5432
        published: 5432
        protocol: tcp
Kévin Dunglas's avatar
Kévin Dunglas a validé
  mercure:
    image: dunglas/mercure
    environment:
      - ALLOW_ANONYMOUS=1
      - CORS_ALLOWED_ORIGINS=*
      - DEMO=1
      - JWT_KEY=!ChangeMe!
      - PUBLISH_ALLOWED_ORIGINS=http://localhost:1337,https://localhost:1338 # required for publishing from demo page
Kévin Dunglas's avatar
Kévin Dunglas a validé
    ports:
      - target: 80
        published: 1337
        protocol: tcp
Kévin Dunglas's avatar
Kévin Dunglas a validé

  client:
    build:
      context: ./client
      target: api_platform_client_development
      cache_from:
        - ${CLIENT_IMAGE:-quay.io/api-platform/client}
    image: ${CLIENT_IMAGE:-quay.io/api-platform/client}
    environment:
      - API_PLATFORM_CLIENT_GENERATOR_ENTRYPOINT=http://api
      - API_PLATFORM_CLIENT_GENERATOR_OUTPUT=src
    volumes:
      - ./client:/usr/src/client:rw,cached
    ports:
      - target: 3000
        published: 80
        protocol: tcp
  admin:
    build:
      context: ./admin
      target: api_platform_admin_development
      cache_from:
        - ${ADMIN_IMAGE:-quay.io/api-platform/admin}
    image: ${ADMIN_IMAGE:-quay.io/api-platform/admin}
    volumes:
      - ./admin:/usr/src/admin:rw,cached
    ports:
      - target: 3000
        published: 81
        protocol: tcp
    # do not use in production!
    build:
      context: ./h2-proxy
    depends_on:
      - client
      - admin
      - api
    ports:
      - target: 443
        published: 443
        protocol: tcp
      - target: 444
        published: 444
        protocol: tcp
      - target: 8443
        published: 8443
        protocol: tcp
      - target: 1338
        published: 1338
        protocol: tcp