docker-compose.yml 2.18 KB
Newer Older
Jan Rabčan's avatar
Jan Rabčan committed
1 2 3 4 5 6 7 8 9 10 11
version: '2'

services:

#TODO remove from Dockerfiles unnecessary packages, FROM, etc...

######################################## DATABASE #################################################
  db:
    container_name: weather-station-db
    restart: always
    image: mysql
Jan Rabčan's avatar
Jan Rabčan committed
12
    command: mysqld --default-authentication-plugin=mysql_native_password
Jan Rabčan's avatar
Jan Rabčan committed
13 14
    environment:
      - MYSQL_ROOT_PASSWORD=qdrabcabc
Jan Rabčan's avatar
Jan Rabčan committed
15
      - MYSQL_USER=weatherstation
Jan Rabčan's avatar
Jan Rabčan committed
16
      - MYSQL_PASSWORD=qdrabcabc
Jan Rabčan's avatar
Jan Rabčan committed
17
      - MYSQL_DATABASE=weatherstation
Jan Rabčan's avatar
Jan Rabčan committed
18
      - TZ=Europe/Prague
Jan Rabčan's avatar
Jan Rabčan committed
19 20
    ports:
          - 3307:3306
Jan Rabčan's avatar
Jan Rabčan committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
    networks:
      - back-end


######################################## REDIS ####################################################
  redis:
    container_name: weather-station-redis
    restart: always
    image: redis:alpine
    networks:
      - back-end
    depends_on:
      - db

######################################## API ######################################################
  weather-station-api:
    container_name: weather-station-api
    restart: always
Jan Rabčan's avatar
Jan Rabčan committed
39 40 41
    # TODO WHEN DEVELOP ENVIRONMENT
    #volumes:
    #  - ../weather-station-api/:/var/www/html/api
Jan Rabčan's avatar
Jan Rabčan committed
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
    build:
      context: .docker/weather-station-api
    networks:
      - front-end
      - back-end
    depends_on:
      - db
      - redis

######################################## FRONTEND #################################################
  weather-station-frontend:
    container_name: weather-station-frontend
    restart: always
    build:
      context: .docker/weather-station
    networks:
      - front-end
    depends_on:
      - db
      - redis
      - weather-station-api


######################################## NGINX ####################################################
  nginx:
    container_name: weather-station-nginx
    restart: always
    tty: true
    build:
       context: .docker/nginx
    volumes:
      - ./logs/nginx:/var/log/nginx
    volumes_from:
      - weather-station-api
      - weather-station-frontend
Jan Rabčan's avatar
Jan Rabčan committed
77 78 79
    networks:
        - front-end
        - back-end
Jan Rabčan's avatar
Jan Rabčan committed
80 81 82 83 84 85 86 87 88 89 90 91 92 93
    ports:
      - 8087:80
    depends_on:
      - db
      - redis
      - weather-station-api
      - weather-station-frontend


networks:
  back-end:
    driver: bridge
  front-end:
    driver: bridge