-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
45 lines (41 loc) · 986 Bytes
/
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
# Reference for docker-compose
# https://levelup.gitconnected.com/dockerized-crud-restful-api-with-go-gorm-jwt-postgresql-mysql-and-testing-61d731430bd8
version: '3.9'
services:
db:
container_name: golang_rest-template-mysql-container
restart: always
image: mysql:5.7
environment:
# Mysql Database
- MYSQL_DATABASE="${DATABASE_NAME}"
# Mysql Password
- MYSQL_ROOT_PASSWORD="${DATABASE_PASSWORD}"
ports:
# <Port exposed> : < MySQL Port running inside container>
- '3306:3306'
volumes:
- my-db:/var/lib/mysql
networks:
- default
app:
container_name: golang_container
tty: true
build: .
ports:
- 5000:5000
restart: on-failure
volumes:
- api:/usr/src/app/
depends_on:
- db
networks:
- default
# Names our volume
volumes:
api:
my-db:
# Networks to be created to facilitate communication between containers
networks:
default:
driver: bridge