ci: 优化镜像构建和docker compose

This commit is contained in:
王一之
2023-07-22 01:43:01 +08:00
parent 0f596a712d
commit 6da8d7fd67
6 changed files with 53 additions and 35 deletions

31
docker-compose.yaml Normal file
View File

@@ -0,0 +1,31 @@
version: "3.9"
services:
mysql:
image: "mysql:8"
container_name: mayfly-go-mysql
environment:
MYSQL_ROOT_PASSWORD: 111049
MYSQL_DATABASE: mayfly-go
TZ: Asia/Shanghai
volumes:
- ./server/docs/docker-compose/mysql/data/mydir:/mydir
- ./server/docs/docker-compose/mysql/data/datadir:/var/lib/mysql
restart: always
server:
image: mayfly-go:v1.3.1
build:
context: .
dockerfile: Dockerfile
container_name: mayfly-go-server
ports:
- "8888:8888"
environment:
TZ: Asia/Shanghai
WAIT_HOSTS: mysql:3306
volumes:
- ./server/config.yml.example:/mayfly/config.yml
depends_on:
- mysql
restart: always