-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UPDATE] 更新持续集成,自动将 central-studio 发布到 DockerHub 中
Signed-off-by: Alan Yeh <[email protected]>
- Loading branch information
Showing
17 changed files
with
541 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Publish Docker Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- '*.x' | ||
|
||
jobs: | ||
publish-to-docker-hub: | ||
name: Publish to DockerHub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: zulu | ||
server-id: github | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
gpg-passphrase: GPG_PASSPHRASE | ||
- name: Set up Docker(QEMU) | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker(Buildx) | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver-opts: image=moby/buildkit:master | ||
platforms: linux/amd64,linux/arm64 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Build packages | ||
run: mvn -P github clean package | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.GHPKG_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.GHPKG_TOKEN }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
- name: Build and deploy to DockerHub | ||
uses: docker/bake-action@v4 | ||
with: | ||
push: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# 多阶段构建 | ||
# 第一阶段将 Spring Boot 应用程序进行拆分 | ||
|
||
FROM centralx/openjdk:17 as builder | ||
|
||
ARG STUDIO_VERSION | ||
|
||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
|
||
# 复制应用到工作目录 | ||
COPY central-dashboard-${STUDIO_VERSION}.jar application.jar | ||
|
||
# 使用 Spring Boot 工具对应用进行分层 | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
|
||
# 第二阶段,正式构建应用 | ||
FROM centralx/openjdk:17 | ||
MAINTAINER Alan Yeh <[email protected]> | ||
LABEL vender=CentralX \ | ||
license="The MIT License" \ | ||
name="Central Dashboard" | ||
|
||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
RUN mkdir /workspace/config && mkdir /workspace/logs && mkdir /workspace/data | ||
|
||
# 将上一阶段提取的应用分层复制到工作目录 | ||
COPY --from=builder /workspace/dependencies ./ | ||
COPY --from=builder /workspace/spring-boot-loader ./ | ||
COPY --from=builder /workspace/snapshot-dependencies ./ | ||
COPY --from=builder /workspace/application ./ | ||
|
||
# 添加 runner 用户,并对并授权 | ||
RUN adduser runner -D -u 1000 && chown -R runner:runner /workspace | ||
|
||
# 切换到非 root 用户启动程序 | ||
USER runner | ||
|
||
# 最大内存 | ||
ENV JVM_MAX_HEAP 768m | ||
# 最小内存 | ||
ENV JVM_MIN_HEAP 256m | ||
# 其它 JVM 参数 | ||
ENV JVM_OPTS "-XX:+UseG1GC" | ||
# 启动参数 | ||
ENV BOOTSTRAP_OPTS "-Djava.security.egd=file:/dev/./urandom -Dspring.config.additional-location=optional:./config/" | ||
|
||
EXPOSE 3100 | ||
VOLUME ["/workspace/config", "/workspace/logs", "/workspace/data"] | ||
ENTRYPOINT ["sh", "-c", "java -Xms$JVM_MIN_HEAP -Xmx$JVM_MAX_HEAP $JVM_OPTS $BOOTSTRAP_OPTS org.springframework.boot.loader.JarLauncher"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,52 @@ | ||
FROM openjdk:17 | ||
MAINTAINER Alan Yeh "[email protected]" | ||
# 多阶段构建 | ||
# 第一阶段将 Spring Boot 应用程序进行拆分 | ||
|
||
ENV TIME_ZONE="Asia/Shanghai" | ||
RUN set -x \ | ||
&& ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo '$TIME_ZONE' > /etc/timezone \ | ||
&& useradd --create-home app | ||
FROM centralx/openjdk:17 as builder | ||
|
||
# 使用非 root 用户执行程序 | ||
USER app | ||
ARG STUDIO_VERSION | ||
|
||
# 暴露端口 | ||
EXPOSE 8080 | ||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
|
||
# 在用户目录下启动应用 | ||
WORKDIR ~ | ||
ARG JAR_FILE | ||
ADD target/${JAR_FILE} ./app.jar | ||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.config.additional-location=optional:./config/bootstrap.yml", "-jar", "app.jar"] | ||
# 复制应用到工作目录 | ||
COPY central-gateway-${STUDIO_VERSION}.jar application.jar | ||
|
||
# 暴露卷 | ||
VOLUME ./config | ||
VOLUME ./data | ||
# 使用 Spring Boot 工具对应用进行分层 | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
|
||
# 第二阶段,正式构建应用 | ||
FROM centralx/openjdk:17 | ||
MAINTAINER Alan Yeh <[email protected]> | ||
LABEL vender=CentralX \ | ||
license="The MIT License" \ | ||
name="Central Gateway" | ||
|
||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
RUN mkdir /workspace/config && mkdir /workspace/logs && mkdir /workspace/data | ||
|
||
# 将上一阶段提取的应用分层复制到工作目录 | ||
COPY --from=builder /workspace/dependencies ./ | ||
COPY --from=builder /workspace/spring-boot-loader ./ | ||
COPY --from=builder /workspace/snapshot-dependencies ./ | ||
COPY --from=builder /workspace/application ./ | ||
|
||
# 添加 runner 用户,并对并授权 | ||
RUN adduser runner -D -u 1000 && chown -R runner:runner /workspace | ||
|
||
# 切换到非 root 用户启动程序 | ||
USER runner | ||
|
||
# 最大内存 | ||
ENV JVM_MAX_HEAP 768m | ||
# 最小内存 | ||
ENV JVM_MIN_HEAP 256m | ||
# 其它 JVM 参数 | ||
ENV JVM_OPTS "-XX:+UseG1GC" | ||
# 启动参数 | ||
ENV BOOTSTRAP_OPTS "-Djava.security.egd=file:/dev/./urandom -Dspring.config.additional-location=optional:./config/" | ||
|
||
EXPOSE 3000 | ||
VOLUME ["/workspace/config", "/workspace/logs", "/workspace/data"] | ||
ENTRYPOINT ["sh", "-c", "java -Xms$JVM_MIN_HEAP -Xmx$JVM_MAX_HEAP $JVM_OPTS $BOOTSTRAP_OPTS org.springframework.boot.loader.JarLauncher"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# 多阶段构建 | ||
# 第一阶段将 Spring Boot 应用程序进行拆分 | ||
|
||
FROM centralx/openjdk:17 as builder | ||
|
||
ARG STUDIO_VERSION | ||
|
||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
|
||
# 复制应用到工作目录 | ||
COPY central-logging-${STUDIO_VERSION}.jar application.jar | ||
|
||
# 使用 Spring Boot 工具对应用进行分层 | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
|
||
# 第二阶段,正式构建应用 | ||
FROM centralx/openjdk:17 | ||
MAINTAINER Alan Yeh <[email protected]> | ||
LABEL vender=CentralX \ | ||
license="The MIT License" \ | ||
name="Central Logging" | ||
|
||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
RUN mkdir /workspace/config && mkdir /workspace/logs && mkdir /workspace/data | ||
|
||
# 将上一阶段提取的应用分层复制到工作目录 | ||
COPY --from=builder /workspace/dependencies ./ | ||
COPY --from=builder /workspace/spring-boot-loader ./ | ||
COPY --from=builder /workspace/snapshot-dependencies ./ | ||
COPY --from=builder /workspace/application ./ | ||
|
||
# 添加 runner 用户,并对并授权 | ||
RUN adduser runner -D -u 1000 && chown -R runner:runner /workspace | ||
|
||
# 切换到非 root 用户启动程序 | ||
USER runner | ||
|
||
# 最大内存 | ||
ENV JVM_MAX_HEAP 768m | ||
# 最小内存 | ||
ENV JVM_MIN_HEAP 256m | ||
# 其它 JVM 参数 | ||
ENV JVM_OPTS "-XX:+UseG1GC" | ||
# 启动参数 | ||
ENV BOOTSTRAP_OPTS "-Djava.security.egd=file:/dev/./urandom -Dspring.config.additional-location=optional:./config/" | ||
|
||
EXPOSE 3400 | ||
VOLUME ["/workspace/config", "/workspace/logs", "/workspace/data"] | ||
ENTRYPOINT ["sh", "-c", "java -Xms$JVM_MIN_HEAP -Xmx$JVM_MAX_HEAP $JVM_OPTS $BOOTSTRAP_OPTS org.springframework.boot.loader.JarLauncher"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# 多阶段构建 | ||
# 第一阶段将 Spring Boot 应用程序进行拆分 | ||
|
||
FROM centralx/openjdk:17 as builder | ||
|
||
ARG STUDIO_VERSION | ||
|
||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
|
||
# 复制应用到工作目录 | ||
COPY central-multicast-${STUDIO_VERSION}.jar application.jar | ||
|
||
# 使用 Spring Boot 工具对应用进行分层 | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
|
||
# 第二阶段,正式构建应用 | ||
FROM centralx/openjdk:17 | ||
MAINTAINER Alan Yeh <[email protected]> | ||
LABEL vender=CentralX \ | ||
license="The MIT License" \ | ||
name="Central Multicast" | ||
|
||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
RUN mkdir /workspace/config && mkdir /workspace/logs && mkdir /workspace/data | ||
|
||
# 将上一阶段提取的应用分层复制到工作目录 | ||
COPY --from=builder /workspace/dependencies ./ | ||
COPY --from=builder /workspace/spring-boot-loader ./ | ||
COPY --from=builder /workspace/snapshot-dependencies ./ | ||
COPY --from=builder /workspace/application ./ | ||
|
||
# 添加 runner 用户,并对并授权 | ||
RUN adduser runner -D -u 1000 && chown -R runner:runner /workspace | ||
|
||
# 切换到非 root 用户启动程序 | ||
USER runner | ||
|
||
# 最大内存 | ||
ENV JVM_MAX_HEAP 768m | ||
# 最小内存 | ||
ENV JVM_MIN_HEAP 256m | ||
# 其它 JVM 参数 | ||
ENV JVM_OPTS "-XX:+UseG1GC" | ||
# 启动参数 | ||
ENV BOOTSTRAP_OPTS "-Djava.security.egd=file:/dev/./urandom -Dspring.config.additional-location=optional:./config/" | ||
|
||
EXPOSE 3600 | ||
VOLUME ["/workspace/config", "/workspace/logs", "/workspace/data"] | ||
ENTRYPOINT ["sh", "-c", "java -Xms$JVM_MIN_HEAP -Xmx$JVM_MAX_HEAP $JVM_OPTS $BOOTSTRAP_OPTS org.springframework.boot.loader.JarLauncher"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,52 @@ | ||
FROM openjdk:17 | ||
MAINTAINER Alan Yeh "[email protected]" | ||
# 多阶段构建 | ||
# 第一阶段将 Spring Boot 应用程序进行拆分 | ||
|
||
ENV TIME_ZONE="Asia/Shanghai" | ||
RUN set -x \ | ||
&& ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo '$TIME_ZONE' > /etc/timezone \ | ||
&& useradd --create-home app | ||
FROM centralx/openjdk:17 as builder | ||
|
||
# 使用非 root 用户执行程序 | ||
USER app | ||
ARG STUDIO_VERSION | ||
|
||
# 暴露端口 | ||
EXPOSE 8080 | ||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
|
||
# 在用户目录下启动应用 | ||
WORKDIR ~ | ||
ARG JAR_FILE | ||
ADD target/${JAR_FILE} ./app.jar | ||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.config.additional-location=optional:./config/bootstrap.yml", "-jar", "app.jar"] | ||
# 复制应用到工作目录 | ||
COPY central-provider-${STUDIO_VERSION}.jar application.jar | ||
|
||
# 暴露卷 | ||
VOLUME ./config | ||
VOLUME ./data | ||
# 使用 Spring Boot 工具对应用进行分层 | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
|
||
# 第二阶段,正式构建应用 | ||
FROM centralx/openjdk:17 | ||
MAINTAINER Alan Yeh <[email protected]> | ||
LABEL vender=CentralX \ | ||
license="The MIT License" \ | ||
name="Central Provider" | ||
|
||
# 创建工作目录及常用子目录 | ||
WORKDIR /workspace | ||
RUN mkdir /workspace/config && mkdir /workspace/logs && mkdir /workspace/data | ||
|
||
# 将上一阶段提取的应用分层复制到工作目录 | ||
COPY --from=builder /workspace/dependencies ./ | ||
COPY --from=builder /workspace/spring-boot-loader ./ | ||
COPY --from=builder /workspace/snapshot-dependencies ./ | ||
COPY --from=builder /workspace/application ./ | ||
|
||
# 添加 runner 用户,并对并授权 | ||
RUN adduser runner -D -u 1000 && chown -R runner:runner /workspace | ||
|
||
# 切换到非 root 用户启动程序 | ||
USER runner | ||
|
||
# 最大内存 | ||
ENV JVM_MAX_HEAP 768m | ||
# 最小内存 | ||
ENV JVM_MIN_HEAP 256m | ||
# 其它 JVM 参数 | ||
ENV JVM_OPTS "-XX:+UseG1GC" | ||
# 启动参数 | ||
ENV BOOTSTRAP_OPTS "-Djava.security.egd=file:/dev/./urandom -Dspring.config.additional-location=optional:./config/" | ||
|
||
EXPOSE 3300 | ||
VOLUME ["/workspace/config", "/workspace/logs", "/workspace/data"] | ||
ENTRYPOINT ["sh", "-c", "java -Xms$JVM_MIN_HEAP -Xmx$JVM_MAX_HEAP $JVM_OPTS $BOOTSTRAP_OPTS org.springframework.boot.loader.JarLauncher"] |
Oops, something went wrong.