第一版封板

This commit is contained in:
dengqichen 2025-05-28 13:02:19 +08:00
parent eddb24aa5b
commit 2f5e668d36
2 changed files with 81 additions and 0 deletions

19
docker-compose.yml Normal file
View File

@ -0,0 +1,19 @@
# 使用远程Docker daemon构建和运行
# 设置环境变量: export DOCKER_HOST=tcp://172.22.222.6:2375
# 或者运行: docker-compose --host tcp://172.22.222.6:2375 up -d
services:
task-reminder:
image: 172.22.222.100:28082/task-reminder:1.0.0
container_name: task-reminder-app
restart: always
user: root
network_mode: default
ports:
- "18888:8080"
environment:
- TZ=Asia/Shanghai
volumes:
- ./logs:/app/logs
networks:
default:
external: true

62
pom.xml
View File

@ -73,6 +73,68 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- Docker构建插件 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- 在install阶段构建Docker镜像 -->
<execution>
<id>docker-build</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>docker</executable>
<arguments>
<argument>-H</argument>
<argument>tcp://172.22.222.6:2375</argument>
<argument>build</argument>
<argument>-t</argument>
<argument>172.22.222.100:28082/task-reminder:1.0.0</argument>
<argument>.</argument>
</arguments>
</configuration>
</execution>
<!-- 在install阶段推送Docker镜像 -->
<execution>
<id>docker-push</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>docker</executable>
<arguments>
<argument>-H</argument>
<argument>tcp://172.22.222.6:2375</argument>
<argument>push</argument>
<argument>172.22.222.100:28082/task-reminder:1.0.0</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>docker-run</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>docker</executable>
<arguments>
<argument>-H</argument>
<argument>tcp://172.22.222.6:2375</argument>
<argument>compose</argument>
<argument>up</argument>
<argument>-d</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>