Ctrl K
ComunidadGuías…

compose.yml

Rama master · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# yaml-language-server: $schema=https://cdn.jsdelivr.net/gh/compose-spec/compose-spec@master/schema/compose-spec.json

services:
  app: # common use case is to run shell or execute commands
    build: &app-build {dockerfile: Dockerfile, target: builder}
    env_file: &app-env-file [{path: .env, required: false}]
    environment: {HOME: /tmp, LOG_LEVEL: debug}
    volumes: [.:/src:rw, app-tmp-data:/tmp:rw, app-modules-cache:/var/tmp/go:rw]
    security_opt: [no-new-privileges:true]

  app-http:
    build: *app-build
    env_file: *app-env-file
    command: go run ./cmd/webhook-tester/ start --use-live-frontend --auto-create-sessions --max-requests 16
    volumes: [.:/src:rw]
    ports: ['8080:8080/tcp'] # open http://127.0.0.1:8080
    healthcheck:
      test: ['CMD', 'wget', '--spider', '-q', 'http://127.0.0.1:8080/healthz']
      start_interval: 1s
      interval: 10s
      start_period: 10s
    depends_on: {app-web-dist: {condition: service_healthy}}
    security_opt: [no-new-privileges:true]

  app-web-dist:
    build: *app-build
    env_file: *app-env-file
    user: node
    volumes: [.:/src:rw]
    working_dir: /src/web
    command: npm run watch
    healthcheck:
      test: ['CMD', 'test', '-f', './dist/robots.txt']
      start_interval: 1s
      interval: 10s
      start_period: 20s
    security_opt: [no-new-privileges:true]

  app-web-serve:
    build: *app-build
    env_file: *app-env-file
    user: node
    volumes: [.:/src:rw]
    working_dir: /src/web
    environment: {DEV_SERVER_PROXY_TO: http://app-http:8080} # tell to vite dev server "where is the API"
    command: npm run serve -- --host 0.0.0.0 --port 8080
    ports: ['8081:8080/tcp'] # open http://127.0.0.1:8081
    healthcheck:
      test: ['CMD', 'wget', '--spider', '-q', 'http://127.0.0.1:8080']
      start_interval: 1s
      interval: 3s
      start_period: 10s
    security_opt: [no-new-privileges:true]

  redis:
    image: docker.io/library/redis:8-alpine
    volumes: [redis-data:/data:rw]
    ports: ['6379/tcp']
    healthcheck:
      test: ['CMD', 'redis-cli', 'ping']
      interval: 500ms
      timeout: 1s
    security_opt: [no-new-privileges:true]

  k6:
    image: ghcr.io/grafana/k6:latest
    volumes: [.:/src:ro]
    working_dir: /src
    environment:
      BASE_URL: http://app-http:8080
      K6_NO_USAGE_REPORT: 'true'
    depends_on: {app-http: {condition: service_healthy}}
    security_opt: [no-new-privileges:true]

volumes:
  app-modules-cache: {}
  app-tmp-data: {}
  redis-data: {}