Showing
3 changed files
with
82 additions
and
0 deletions
Dockerfile
0 → 100644
| 1 | +FROM openjdk:17-jdk-alpine | ||
| 2 | + | ||
| 3 | +# 保持系统更新并安装必要的构建工具 | ||
| 4 | +RUN apk update && apk add --no-cache bash build-base | ||
| 5 | +# 安装MediaInfo工具 | ||
| 6 | +RUN apk --no-cache add mediainfo | ||
| 7 | + | ||
| 8 | +###以下为修改项每个业务有差异### | ||
| 9 | +ADD target/crp-operation-1.0.0.jar /opt/ | ||
| 10 | + | ||
| 11 | +###设置时区### | ||
| 12 | +ENV TZ=Asia/Shanghai | ||
| 13 | +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
| 14 | + | ||
| 15 | +### JAVA参数调优 | ||
| 16 | +### ENV JAVA_OPTS='-Xms216m -Xmx512m' | ||
| 17 | + | ||
| 18 | +## 启动命令 | ||
| 19 | +CMD java -jar /opt/crp-operation-1.0.0.jar --spring.profiles.active=${SPRING_PROFILE_ACTIVE} |
docker/Dockerfile
0 → 100644
| 1 | +FROM 192.168.1.7/library/java17:centos7 | ||
| 2 | + | ||
| 3 | +ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \ | ||
| 4 | +SPRING_PROFILE_ACTIVE=preview \ | ||
| 5 | +SPRING_OPTS="" \ | ||
| 6 | +JAVA_OPTS="" | ||
| 7 | +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /app.jar --spring.profiles.active=${SPRING_PROFILE_ACTIVE} ${SPRING_OPTS} | ||
| 8 | +RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone | ||
| 9 | +ADD target/*.jar /app.jar |
| @@ -189,6 +189,60 @@ | @@ -189,6 +189,60 @@ | ||
| 189 | 189 | ||
| 190 | 190 | ||
| 191 | </plugins> | 191 | </plugins> |
| 192 | + | ||
| 193 | + <pluginManagement> | ||
| 194 | + <plugins> | ||
| 195 | + <plugin> | ||
| 196 | + <groupId>com.spotify</groupId> | ||
| 197 | + <artifactId>docker-maven-plugin</artifactId> | ||
| 198 | + <version>1.2.2</version> | ||
| 199 | + <executions> | ||
| 200 | + <execution> | ||
| 201 | + <id>build-image</id> | ||
| 202 | + <phase>package</phase> | ||
| 203 | + <goals> | ||
| 204 | + <goal>build</goal> | ||
| 205 | + <goal>push</goal> | ||
| 206 | + </goals> | ||
| 207 | + </execution> | ||
| 208 | + </executions> | ||
| 209 | + <configuration> | ||
| 210 | + <imageName>192.168.1.69/ai_lib/${project.artifactId}:${project.version}</imageName> | ||
| 211 | + <dockerHost>http://192.168.1.70:2375</dockerHost> | ||
| 212 | + <dockerDirectory>${basedir}/docker</dockerDirectory> | ||
| 213 | + <resources> | ||
| 214 | + <resource> | ||
| 215 | + <targetPath>/</targetPath> | ||
| 216 | + <directory>${project.build.directory}</directory> | ||
| 217 | + <include>${project.build.finalName}.jar</include> | ||
| 218 | + </resource> | ||
| 219 | + </resources> | ||
| 220 | + </configuration> | ||
| 221 | + </plugin> | ||
| 222 | + </plugins> | ||
| 223 | + </pluginManagement> | ||
| 224 | + </build> | ||
| 225 | + | ||
| 226 | + <profiles> | ||
| 227 | + <profile> | ||
| 228 | + <id>docker</id> | ||
| 229 | + <properties> | ||
| 230 | + <spring.profiles.active>preview</spring.profiles.active> | ||
| 231 | + </properties> | ||
| 232 | + <build> | ||
| 233 | + <plugins> | ||
| 234 | + <plugin> | ||
| 235 | + <groupId>com.spotify</groupId> | ||
| 236 | + <artifactId>docker-maven-plugin</artifactId> | ||
| 237 | + <configuration> | ||
| 238 | + <imageName>192.168.1.7/ivod/${project.artifactId}:${project.version}</imageName> | ||
| 239 | + <dockerHost>http://192.168.1.70:2375</dockerHost> | ||
| 240 | + <serverId>wd-harbor</serverId> | ||
| 241 | + </configuration> | ||
| 242 | + </plugin> | ||
| 243 | + </plugins> | ||
| 192 | </build> | 244 | </build> |
| 245 | + </profile> | ||
| 246 | + </profiles> | ||
| 193 | 247 | ||
| 194 | </project> | 248 | </project> |
-
Please register or login to post a comment