version: "3.9" networks: next-docs-net: volumes: node_modules: redis_data: # Default for all services x-service-defaults: &service-defaults restart: unless-stopped networks: - next-docs-net # Defaults for all app-based node services x-app-defaults: &app-defaults <<: *service-defaults build: context: . dockerfile: Dockerfile.dev command: ["yarn"] working_dir: /opt/next-docs depends_on: - cache restart: on-failure environment: REDIS_URL: redis://:flow_docs@cache:6379 REFRESH_CACHE_SECRET: for-testing-only INCOMPLETE_PAGE_BEHAVIORL: preview SENTRY_ENV: sentry-development SHELL: /bin/bash PORT: 3000 REMIX_DEV_SERVER_WS_PORT: 8002 LOG_LEVEL: "debug" ENABLE_CONTENT_CHECKER: "true" volumes: - .:/opt/next-docs - ./package.json:/opt/next-docs/package.json - ./yarn.lock:/opt/next-docs/yarn.lock - node_modules:/opt/next-docs/node_modules services: cache: <<: *service-defaults image: "redis:alpine" command: redis-server --requirepass flow_docs volumes: - redis_data:/data # Run yarn on startup to make sure our packages are up-to-date. app-yarn: <<: *app-defaults restart: on-failure # Watches for CSS changes and rebuilds app-css: <<: *app-defaults command: ["yarn", "run", "dev:css"] healthcheck: # service is healthy once main.css has been generated test: bash -c "[ -f /opt/next-docs/app/main.css ]" interval: 10s retries: 5 start_period: 5s # postcss exits without an stdin # See: https://github.com/postcss/postcss-cli/pull/424 tty: true depends_on: app-yarn: condition: service_completed_successfully # Watches for SVG changes and recreates their components as needed. app-svg: <<: *app-defaults command: ["yarn", "run", "dev:svg"] healthcheck: # "dev:svg" executes "touch /tmp/svgs-generated" after each run, so we # check that this file has been updated within the last 1 minute test: test `find /tmp/svgs-generated -type f -mmin -1` interval: 5s retries: 5 start_period: 15s depends_on: app-yarn: condition: service_completed_successfully # The main application app: <<: *app-defaults command: ["yarn", "run", "dev:remix"] ports: - "3000:3000" # Web app port - "8002:8002" # Websocket for live-reload depends_on: app-css: condition: service_healthy app-svg: condition: service_healthy storybook: <<: *app-defaults profiles: ["storybook"] command: [ "yarn", "run", "start-storybook", "-p", "6006", "--quiet", "--no-open", "--disable-telemetry", ] ports: - "6006:6006"