docker-compose.yml 1.43 KB
version: "3"
services:

 web:
  image: nginx
  container_name: nginx
  ports:
   - "8081:80"
  networks:
   mynet:
    ipv4_address: 172.28.0.2
  volumes:
   - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
   - ./web:/var/www/html
  restart: on-failure
  links:
   - app
 
 svelte:
  image: node
  container_name: svelte
  working_dir: /var/www/html
  volumes:
   - ./web:/var/www/html
  command: bash -c "npm install && npm run dev"
  restart: on-failure

 app:
  image: node
  container_name: node
  ports:
   - "8082:80"
  networks:
   mynet:
    ipv4_address: 172.28.0.3
  working_dir: /app
  volumes:
   - ./node:/app
   - ./config:/app/config
  command: bash -c "npm install && node app.js"
  environment:
   - NODE_ENV=production
  links:
   - db
  depends_on:
   - db
  restart: on-failure

 db:
  image: mariadb:10.2
  container_name: mariadb10.2
  ports:
   - "33066:3306"
  networks:
   mynet:
    ipv4_address: 172.28.0.4
  volumes:
   - mariadb:/var/lib/mysql
   - ./config:/config
  environment:
   MYSQL_ROOT_PASSWORD_FILE: ./config/db_password.txt
   MYSQL_DATABASE: maple
   MYSQL_USER: maple
   MYSQL_PASSWORD_FILE: ./config/db_password.txt
   TZ: Asia/Seoul
  command: --character_set_client=utf8 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --character-set-client-handshake=FALSE
  restart: on-failure

volumes:
  mariadb:

networks:
  mynet:
    ipam:
      driver: default
      config:
        - subnet: 172.28.0.0/16