From 38cbff11b3c296b3b15030ac48da04672bf5de2c Mon Sep 17 00:00:00 2001 From: Grand-cocoa <1075576561@qq.com49111108+grand-cocoa@users.noreply.github.com> Date: Wed, 12 Nov 2025 11:30:15 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E9=85=8D=E7=BD=AE=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=9E=84=E5=BB=BA=E4=B8=8EDocker=E9=83=A8?= =?UTF-8?q?=E7=BD=B2-=20=E6=B7=BB=E5=8A=A0Gitea=E8=87=AA=E5=8A=A8=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E5=B7=A5=E4=BD=9C=E6=B5=81=E9=85=8D=E7=BD=AE=20-=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AEMaven=E5=A4=9A=E7=8E=AF=E5=A2=83Profile?= =?UTF-8?q?=E6=94=AF=E6=8C=81(dev/prod)=20-=20=E7=A7=BB=E9=99=A4spring-boo?= =?UTF-8?q?t-docker-compose=E4=BE=9D=E8=B5=96=20-=20=E9=85=8D=E7=BD=AEDock?= =?UTF-8?q?er=E9=95=9C=E5=83=8F=E6=9E=84=E5=BB=BA=E4=B8=8E=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E7=8E=AF=E5=A2=83=20-=20=E8=AE=BE=E7=BD=AEJDK17?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=8E=AF=E5=A2=83=E4=B8=8ECDS=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20-=20=E9=85=8D=E7=BD=AE=E8=B5=84=E6=BA=90=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=BF=87=E6=BB=A4=E8=A7=84=E5=88=99=20-=20=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E6=9E=84=E5=BB=BA=E8=BE=93=E5=87=BA=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8E=E6=BA=90=E7=A0=81=E8=B7=AF=E5=BE=84=20-=20=E5=90=AF?= =?UTF-8?q?=E7=94=A8Spring=20Profile=E5=8A=A8=E6=80=81=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/auto-build.yaml | 23 ++++++++++++++++ Dockerfile | 10 +++++++ pom.xml | 44 ++++++++++++++++++++++++++---- src/main/resources/application.yml | 2 +- 4 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 .gitea/workflows/auto-build.yaml create mode 100644 Dockerfile diff --git a/.gitea/workflows/auto-build.yaml b/.gitea/workflows/auto-build.yaml new file mode 100644 index 0000000..6348e12 --- /dev/null +++ b/.gitea/workflows/auto-build.yaml @@ -0,0 +1,23 @@ +name: Auto-build +run-name: Automatic-Packaging 📦 +on: [ push ] +env: + BARE_REPO_DIR: https://git.alina-dace.info/Dace/Animo-Server.git + CLONED_REPO_DIR: ./ +jobs: + Automatic-Packaging: + runs-on: ubuntu-latest + steps: + - name: Checkout Git Repo + uses: https://git.alina-dace.info/actions/checkout@v4 + - run: pwd + - name: Set up JDK 17 + uses: https://git.alina-dace.info/actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - run: chmod +x ./mvnw + - name: build + run: ./mvnw clean package -DskipTests=true -P prod + - run: docker build -t animo-server:latest ./ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f3bd48a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM bellsoft/liberica-openjdk-debian:17.0.11-cds + +LABEL maintainer="Kane / Arina Dace / Sakura Reimi" + +ENV LANG C.UTF-8 +ENV LC_ALL C.UTF-8 + +ADD ./target/animo.jar /app.jar + +ENTRYPOINT exec java -jar /app.jar diff --git a/pom.xml b/pom.xml index bd2b91f..8b662dc 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,23 @@ + + + dev + + dev + + + true + + + + prod + + prod + + + 17 @@ -41,12 +58,6 @@ runtime true - - - - - - com.mysql mysql-connector-j @@ -91,6 +102,9 @@ + ${project.artifactId} + ${project.basedir}/src/main/java + ${project.basedir}/src/test/java org.apache.maven.plugins @@ -117,6 +131,24 @@ + + + src/main/resources + + false + + + src/main/resources + + + application* + bootstrap* + banner* + + + true + + diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 351091e..a05bef8 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,7 +3,7 @@ server: spring: profiles: - active: dev + active: @spring.profiles.active@ application: name: Animo