-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
56 lines (53 loc) · 1.44 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
version: '3.7'
services:
db:
container_name: "ecommerce_db"
platform: linux/x86_64
build:
context: .
dockerfile: db.Dockerfile
networks:
- default
restart: always
cap_add:
- SYS_NICE # CAP_SYS_NICE
ports:
# <Port exposed> : < MySQL Port running inside container>
- "3306:3306"
# setting some env vars to create the DB
environment:
# MYSQL_RANDOM_ROOT_PASSWORD: "root"
# MYSQL_DATABASE: "ecommerce"
# MYSQL_USER: "root"
# MYSQL_PASSWORD: "root"
# OR if you want to use "root" as the user, just these two lines
TZ: "/usr/share/zoneinfo/Asia/Jakarta"
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "ecommerce"
# we mount a data volume to make sure we don't lose data
volumes:
- mysql_data:/var/lib/mysql
command: --default-authentication-plugin=mysql_native_password
api:
container_name: "ecommerce_api"
# we want to use the image which is build from our Dockerfile
build:
context: .
dockerfile: api.Dockerfile
ports:
- "9090:9090"
networks:
- default
environment:
APP_ENV: "production"
# we are depending on the mysql backend
depends_on:
- db
# We mount the working dir into the container, handy for development
# This is what makes the hot reloading work inside of a Docker container
volumes:
- .:/app/
networks:
default:
volumes:
mysql_data: