docker-compose.yaml 1.06 KB
Newer Older
1
2
3
4
version: "3.7"
services:
  backend:
    build: backend
5
6
7
    restart: always
    secrets:
      - db-password
8
9
10
11
12
13
    environment:
      MYSQL_HOST: db
    networks:
      - react-spring
      - spring-mysql
    depends_on:
14
15
      db:
        condition: service_healthy
16
17
18
19
  db:
    environment:
      MYSQL_DATABASE: example
      MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
20
    image: mysql:8.0.19
21
    restart: always
22
23
24
25
26
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
      interval: 3s
      retries: 5
      start_period: 30s
27
    secrets:
28
      - db-password
29
    volumes:
30
31
32
      - db-data:/var/lib/mysql
    networks:
      - spring-mysql
33
  frontend:
34
35
36
    build:
      context: frontend
      target: development
37
    ports:
38
      - 3000:3000
39
    volumes:
40
      - ./frontend/src:/code/src
41
42
43
44
45
      - /project/node_modules
    networks:
      - react-spring
    depends_on:
      - backend
46
47
48
    expose:
      - 3306
      - 33060
49
50
51
52
53
volumes:
  db-data: {}
secrets:
  db-password:
    file: db/password.txt
54
55
networks:
  react-spring: {}
56
  spring-mysql: {}