a_igin

compose

Aug 3rd, 2021
898
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. version: '3.7'
  2.  
  3. x-networks: &default-networks
  4.     networks:
  5.      - projname_net
  6.  
  7. x-env: &default-env
  8.   env_file:
  9.    - .docker_env
  10.   environment:
  11.    - projname_VERSION=${CI_COMMIT_SHORT_SHA}
  12.     - projname_DEBUG=${projname_DEBUG}
  13.     - projname_SECRET_KEY=${projname_SECRET_KEY}
  14.     - projname_DB=${projname_DB}
  15.     - projname_DBUSER=${projname_DBUSER}
  16.     - projname_DBPASSWORD=${projname_DBPASSWORD}
  17.     - projname_DBHOST=${projname_DBHOST}
  18.     - projname_DBPORT=${projname_DBPORT}
  19.     - projname_REDIS_DOMAIN=${projname_REDIS_DOMAIN}
  20.     - projname_EMAIL_HOST=${projname_EMAIL_HOST}
  21.     - projname_EMAIL_PORT=${projname_EMAIL_PORT}
  22.     - projname_EMAIL_HOST_USER=${projname_EMAIL_HOST_USER}
  23.     - projname_EMAIL_HOST_PASSWORD=${projname_EMAIL_HOST_PASSWORD}
  24.     - projname_SENTRY_DSN=${projname_SENTRY_DSN}
  25.     - projname_FCM_SERVER_KEY=${projname_FCM_SERVER_KEY}
  26.     - projname_FCM_PUSH_ACTIVE=${projname_FCM_PUSH_ACTIVE}
  27.     - projname_S3_BUCKET=${projname_S3_BUCKET}
  28.     - projname_ACCESS_KEY=${projname_ACCESS_KEY}
  29.     - projname_S3_SECRET_KEY=${projname_S3_SECRET_KEY}
  30.     - projname_S3_REGION=${projname_S3_REGION}
  31.  
  32. x-volumes: &default-volumes
  33.   volumes:
  34.    - projname_media:/srv/projname_files/media
  35.     - projname_static:/srv/projname_files/static
  36.  
  37.  
  38. x-app: &default-app
  39.   image: registry.gitlab.com/accountname/projname:${CI_COMMIT_REF_NAME}
  40.   <<: *default-env
  41.   <<: *default-volumes
  42.   <<: *default-networks
  43.  
  44.  
  45. services:
  46.   db:
  47.     restart: unless-stopped
  48.     image: postgres:9.6.21
  49.     ports:
  50.      - "5432"
  51.     volumes:
  52.      - pgdata:/var/lib/postgresql/data/
  53.     env_file:
  54.      - .docker_env
  55.     environment:
  56.      - POSTGRES_PASSWORD=${projname_DBPASSWORD}
  57.       - POSTGRES_USER=${projname_DBUSER}
  58.       - POSTGRES_DB=${projname_DB}
  59.     <<: *default-networks
  60.   web:
  61.     <<: *default-app
  62.     restart: unless-stopped
  63.     command: bash docker_configs/daphne.sh
  64.     links:
  65.      - "db:db"
  66.     depends_on:
  67.      - db
  68.   nginx:
  69.     build: ./docker_configs/nginx/
  70.     restart: unless-stopped
  71.     ports:
  72.      - "80:80"
  73.     links:
  74.      - "web:web"
  75.     depends_on:
  76.      - web
  77.     <<: *default-volumes
  78.     <<: *default-networks
  79.   redis_container:
  80.     image: "redis:alpine"
  81.     restart: unless-stopped
  82.     command: redis-server /usr/local/etc/redis/redis.conf
  83.     ports:
  84.      - '6379:6379'
  85.     expose:
  86.      - 6379
  87.     volumes:
  88.      - ./docker_configs/redis/redis.conf:/usr/local/etc/redis/redis.conf
  89.     <<: *default-networks
  90.   celery_container:
  91.     <<: *default-app
  92.     restart: unless-stopped
  93.     command: celery -A projname worker -l info
  94.     depends_on:
  95.      - redis_container
  96.   celery_beat:
  97.     <<: *default-app
  98.     restart: unless-stopped
  99.     command: celery -A projname beat -l info
  100.     depends_on:
  101.      - celery_container
  102.   test:
  103.     <<: *default-app
  104.     command: bash tests_gitlab.sh
  105.     restart: "no"
  106.     depends_on:
  107.      - db
  108.       - redis_container
  109.  
  110. volumes:
  111.   pgdata:
  112.   projname_media:
  113.   projname_static:
  114.  
  115. networks:
  116.   projname_net:
RAW Paste Data