From b10ea3b6ba39916a73e6016702bce60a39a95003 Mon Sep 17 00:00:00 2001 From: soul-walker Date: Thu, 21 Mar 2024 15:29:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0local=5Ftest=E6=8C=81?= =?UTF-8?q?=E7=BB=AD=E9=9B=86=E6=88=90=E9=83=A8=E7=BD=B2=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/CI_local_test.yaml | 54 +++++++++++++++++++++++++++++ Dockerfile | 11 ++++++ 2 files changed, 65 insertions(+) create mode 100644 .gitea/workflows/CI_local_test.yaml create mode 100644 Dockerfile diff --git a/.gitea/workflows/CI_local_test.yaml b/.gitea/workflows/CI_local_test.yaml new file mode 100644 index 000000000..e121b2b95 --- /dev/null +++ b/.gitea/workflows/CI_local_test.yaml @@ -0,0 +1,54 @@ +name: CI +run-name: ${{ gitea.actor }} is testing out Gitea Actions +on: + push: + branches: + - local-test + +jobs: + Docker-Build: + runs-on: joylink-local233 + steps: + - name: 检出代码 + uses: https://gitea.joylink.club/actions/checkout@v4 + with: + submodules: recursive + - name: 设置java环境 + uses: https://gitea.joylink.club/actions/setup-java@v0.1.2 + with: + java-version: '11' + distribution: 'zulu' + cache: 'maven' + cache-dependency-path: './pom.xml' + - name: 构建 + run: | + mvn -Dmaven.test.skip=true clean package + - name: 设置 Docker + uses: https://gitea.joylink.club/actions/local-setup-docker-cli-action@v0.1.1 + - name: 设置 Docker Buildx + uses: https://gitea.joylink.club/actions/local-setup-buildx-action@v0.1.3 + - name: docker登录gitea.joylink.club + uses: https://gitea.joylink.club/docker/login-action@v3 + with: + registry: gitea.joylink.club + username: shengxuqiang + password: ${{ secrets.SHENGXUQIANG_PASSWORD }} + - name: Docker Build and push + uses: https://gitea.joylink.club/docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile_Gitea + push: true + tags: | + gitea.joylink.club/joylink/rt-sim-training-service:local-test + - name: 发布到本地测试环境 + uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.LOCAL_233_SSH_HOST }} + port: ${{ secrets.LOCAL_233_SSH_PORT }} + username: ${{ secrets.LOCAL_233_SSH_USER }} + password: ${{ secrets.LOCAL_233_SSH_PASSWORD }} + script: | + docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist" + docker pull gitea.joylink.club/joylink/rt-sim-training-service:local-test + docker run --name rt-sim-training-service --restart=always --network net --ip 192.168.53.3 -d -e APP_ENV=local-test -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:local-test \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..f9a6f5118 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM azul/zulu-openjdk-alpine:11 + +ADD target/rtss-0.0.1-SNAPSHOT.jar rtss-service.jar + +ENV APP_ENV=prd +EXPOSE 9000 19000/tcp + +ENV TZ=Asia/Shanghai +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +CMD java -jar -Dfile.encoding=UTF-8 -Dspring.profiles.active=$APP_ENV /rtss-service.jar \ No newline at end of file