# TODO: use docker-compose extend: for compact purpose version: '3.0' networks: ctel-sbt: driver: bridge services: cope2n-fi-sbt: build: context: cope2n-ai-fi shm_size: 10gb dockerfile: Dockerfile shm_size: 10gb image: sidp/cope2n-ai-fi-sbt mem_limit: 8g restart: always # container_name: "sidp-cope2n-ai-fi-sbt" networks: - ctel-sbt privileged: true environment: - CELERY_BROKER=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-sbt:5672 - CUDA_VISIBLE_DEVICES=0 volumes: - ./cope2n-ai-fi:/workspace/cope2n-ai-fi # for dev container only working_dir: /workspace/cope2n-ai-fi # deploy: # resources: # reservations: # devices: # - driver: nvidia # count: 1 # capabilities: [gpu] # command: bash -c "tail -f > /dev/null" command: bash run.sh deploy: mode: replicated replicas: 2 # Back-end services be-ctel-sbt: build: context: cope2n-api dockerfile: Dockerfile ports: - 9880:9000 image: sidp/cope2n-be-fi-sbt # container_name: "sidp-cope2n-be-ctel-sbt" environment: - MEDIA_ROOT=${MEDIA_ROOT} - DB_ENGINE=${DB_ENGINE} - DB_SCHEMA=${DB_SCHEMA} - DB_USER=${DB_USER} - DB_PASSWORD=${DB_PASSWORD} - DB_HOST=${DB_HOST} - DB_PORT=${DB_PUBLIC_PORT} - DEBUG=${DEBUG} - CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS} - BASE_PORT=${BASE_PORT} - CTEL_KEY=${CTEL_KEY} - SECRET_KEY=${SECRET_KEY} - ALLOWED_HOSTS=${ALLOWED_HOSTS} - BROKER_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-sbt:5672 - BASE_URL=http://be-ctel-sbt:${BASE_PORT} - BASE_UI_URL=http://fe:${VITE_PORT} - AUTH_TOKEN_LIFE_TIME=${AUTH_TOKEN_LIFE_TIME} - IMAGE_TOKEN_LIFE_TIME=${IMAGE_TOKEN_LIFE_TIME} - INTERNAL_SDS_KEY=${INTERNAL_SDS_KEY} - FI_USER_NAME=${FI_USER_NAME} - FI_PASSWORD=${FI_PASSWORD} # - S3_ENDPOINT=http://minio:9884 - S3_ACCESS_KEY=${S3_ACCESS_KEY} - S3_SECRET_KEY=${S3_SECRET_KEY} - S3_BUCKET_NAME=${S3_BUCKET_NAME} # restart: always networks: - ctel-sbt volumes: - ${HOST_MEDIA_FOLDER}:${MEDIA_ROOT} - BE_static:/app/static # - ./cope2n-api:/app working_dir: /app # depends_on: # db: # condition: service_started # rabbitmq: # condition: service_started command: sh -c "python manage.py collectstatic --no-input && python manage.py migrate && python manage.py compilemessages && gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker -b 0.0.0.0:9000" # pre-makemigrations on prod # command: sh -c "tail -f > /dev/null" # minio: # image: minio/minio #ports: # - 9884:9884 # - 9885:9885 #environment: # - MINIO_ACCESS_KEY=${S3_ACCESS_KEY} # - MINIO_SECRET_KEY=${S3_SECRET_KEY} #volumes: # - ./minio_data:/data #networks: # - ctel-sbt #command: server --address :9884 --console-address :9885 /data be-celery-sbt: # build: # context: cope2n-api # dockerfile: Dockerfile # args: # - "UID=${UID:-1000}" # - "GID=${GID:-1000}" image: sidp/cope2n-be-fi-sbt # container_name: "sidp-cope2n-be-celery-sbt" environment: - MEDIA_ROOT=${MEDIA_ROOT} - PYTHONPATH=${PYTHONPATH}:/app # For import module - PYTHONUNBUFFERED=1 # For show print log - DB_ENGINE=${DB_ENGINE} - DB_SCHEMA=${DB_SCHEMA} - DB_USER=${DB_USER} - DB_PASSWORD=${DB_PASSWORD} - DB_HOST=${DB_HOST} - DB_PORT=${DB_PUBLIC_PORT} - BROKER_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq-sbt:5672 - BASE_UI_URL=http://fe:${VITE_PORT} - DEBUG=${DEBUG} - IMAGE_TOKEN_LIFE_TIME=${IMAGE_TOKEN_LIFE_TIME} - CTEL_KEY=${CTEL_KEY} - SECRET_KEY=${SECRET_KEY} - ALLOWED_HOSTS=${ALLOWED_HOSTS} # - S3_ENDPOINT=http://minio:9884 - S3_ACCESS_KEY=${S3_ACCESS_KEY} - S3_SECRET_KEY=${S3_SECRET_KEY} - S3_BUCKET_NAME=${S3_BUCKET_NAME} - BASE_URL=http://be-ctel-sbt:${BASE_PORT} networks: - ctel-sbt # restart: always depends_on: db-sbt: condition: service_started rabbitmq-sbt: condition: service_started volumes: - ${HOST_MEDIA_FOLDER}:${MEDIA_ROOT} # - sqlite_data:/app/ # - ./cope2n-api:/app working_dir: /app command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO" # Back-end persistent db-sbt: mem_reservation: 500m mem_limit: 1g # container_name: sidp-cope2n-be-sbt-db image: postgres:14.7-alpine volumes: - ./postgres_data:/var/lib/postgresql/data working_dir: /workspace/cope2n-api networks: - ctel-sbt environment: - POSTGRES_USER=${DB_USER} - POSTGRES_PASSWORD=${DB_PASSWORD} - POSTGRES_DB=${DB_SCHEMA} rabbitmq-sbt: mem_reservation: 600m mem_limit: 4g # container_name: sidp-cope2n-be-rabbitmq-sbt restart: always image: rabbitmq:3.10-alpine # ports: # - 5672:5672 volumes: - rabbitmq_data:/var/lib/rabbitmq working_dir: /workspace/cope2n-api networks: - ctel-sbt environment: - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER} - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS} # Front-end services fe-sbt: build: context: cope2n-fe shm_size: 10gb dockerfile: Dockerfile shm_size: 10gb image: sidp/cope2n-fe-fi-sbt container_name: "sidp-cope2n-fe-ctel-sbt" privileged: true ports: - 9881:80 depends_on: be-ctel-sbt: condition: service_started be-celery-sbt: condition: service_started environment: - VITE_PROXY=http://be-ctel-sbt:${BASE_PORT} # - VITE_PROXY=http://42.96.42.13:9880 - VITE_API_BASE_URL=http://fe-sbt:80 volumes: - BE_static:/backend-static l-sbt networks: - ctel-sbt volumes: db_data: rabbitmq_data: sqlite_data: BE_static: