Skip to content

Commit 9d50c4c

Browse files
committed
fix: docker-compose mysql 启动慢
1 parent 4531b56 commit 9d50c4c

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ WORKDIR /app
3939
ENV TZ=Asia/Shanghai
4040

4141
RUN chmod 777 /app
42+
RUN chmod 777 /app/logs
4243
COPY --from=publish /app/publish .
4344
COPY --from=ui /app/dist ./wwwroot
4445
ENTRYPOINT ["dotnet", "OpenTask.WebApi.dll"]

deploy/docker-compose/docker-compose.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.9'
1+
version: '4.9'
22
services:
33
mysql:
44
restart: always
@@ -12,19 +12,25 @@ services:
1212
- "MYSQL_DATABASE=open_task"
1313
ports:
1414
- 3306:3306
15-
15+
healthcheck:
16+
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
17+
interval: 2s
18+
timeout: 2s
19+
retries: 10
20+
1621
api:
1722
restart: always
1823
image: registry.cn-hangzhou.aliyuncs.com/hgui/opentask:latest
1924
container_name: opentask
2025
depends_on:
21-
- mysql
26+
mysql:
27+
condition: service_healthy
2228
volumes:
23-
- /apps/opentask/logs:/app/Logs
29+
- /apps/opentask/logs:/app/logs
2430
environment:
2531
- "ConnectionStrings__Core=server=mysql;Port=3306;user id=root;database=open_task;pooling=true;password=OPEN_TASK_!@#"
2632
- "TZ=Asia/Shanghai"
2733
ports:
2834
- 8080:8080
2935
links:
30-
- mysql
36+
- mysql

src/OpenTask.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0.Solution Items", "0.Solut
2121
.editorconfig = .editorconfig
2222
Directory.Build.props = Directory.Build.props
2323
..\deploy\docker-compose\docker-compose.yml = ..\deploy\docker-compose\docker-compose.yml
24-
..\.github\workflows\docker-image.yml = ..\.github\workflows\docker-image.yml
2524
..\Dockerfile = ..\Dockerfile
2625
..\publish.sh = ..\publish.sh
2726
..\README.md = ..\README.md

0 commit comments

Comments
 (0)