From 83bafabb14a74d6fa3bd33afb5724e2284afb04a Mon Sep 17 00:00:00 2001 From: etc404 Date: Tue, 21 Apr 2026 15:35:18 -0600 Subject: [PATCH] CI/CD Additions --- .gitea/workflows/build.yaml | 49 +++++++++++++++++++++++ Dockerfile | 6 +-- pom.xml | 4 +- src/main/resources/application.properties | 4 +- 4 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..a02263e --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,49 @@ +name: Build Docker Container + +on: + push: + branches: [ "stable" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Get Metadata + id: meta + run: | + echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT + echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT + + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: 3.9.14 + + - name: Set up JDK 25 + uses: actions/setup-java@v4 + with: + java-version: 25 + distribution: 'oracle' + cache: 'maven' + + - name: Build with Maven + run: mvn clean package -Dmaven.test.skip + + - name: Log into registry + uses: docker/login-action@v2 + with: + registry: https://git.ls-r.net + username: etc404 + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + push: true + tags: | + git.ls-r.net/etc404/thymecrunch:${{ steps.meta.outputs.REPO_VERSION }} + git.ls-r.net/etc404/thymecrunch:latest diff --git a/Dockerfile b/Dockerfile index f5f438d..ca0e9e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM eclipse-temurin:25 -WORKDIR /app -COPY target/demo-0.0.1-SNAPSHOT.jar app.jar +ENV APP_HOME /usr/src/app +COPY target/thymecrunch-0.0.1-SNAPSHOT.jar $APP_HOME/app.jar EXPOSE 8080 -ENTRYPOINT ["java","-jar","app.jar"] +ENTRYPOINT exec java -jar $APP_HOME/app.jar diff --git a/pom.xml b/pom.xml index a677ca3..9fe6075 100644 --- a/pom.xml +++ b/pom.xml @@ -9,9 +9,9 @@ com.example - demo + thymecrunch 0.0.1-SNAPSHOT - recipeDemo + ThymeCrunch Software engineering recipe project diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b02ea19..48a2ae9 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,4 @@ -spring.application.name=demo - - +spring.application.name=thymecrunch spring.datasource.url=jdbc:mysql://localhost:3306/demo spring.datasource.username=springuser