-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
52 lines (48 loc) · 1.29 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
version: '3'
services:
go-microservice:
build: .
image: go-microservice
environment:
- MYSQL_URL=sql://user:pass
- MONGODB_URL=mongodb://mongodb:27017/go-boilerplate
ports:
- '8080:8080'
restart: on-failure
depends_on:
- mysqldb
#volumes:
# - .:/srv/go-app
networks:
- go-network
mysqldb:
command: --default-authentication-plugin=mysql_native_password
platform: linux/x86_64
image: mysql:latest
restart: always
environment:
MYSQL_DATABASE: 'boilerplate_go'
# Password for root access
MYSQL_ROOT_PASSWORD: 'youShouldChangeThisPassword'
MYSQL_HOST: "%" # Allow connections from outside the container
# So you don't have to use root, but you can if you like
MYSQL_USER: 'appuser'
# You can use whatever password you like
MYSQL_PASSWORD: 'youShouldChangeThisPassword'
ports:
# <Port exposed> : < MySQL Port running inside container>
- '33006:3306'
expose:
# Opens port 3306 on the container
- '3306'
# Where our data will be persisted
volumes:
- ./docker/scripts/schema.sql:/docker-entrypoint-initdb.d/setup.sql
- dbdata:/var/lib/mysql
networks:
- go-network
volumes:
dbdata:
networks:
go-network:
driver: bridge