From 5fb7c77d7090bb64f251072f3e43610591f8b7e9 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 23 Jul 2024 12:33:58 +0100 Subject: [PATCH] ci --- .gitea/workflows/ci.yml | 31 +++++++++++++++++++++++++++++++ Dockerfile | 27 +++++++++++++++++++++++++++ pom.xml | 2 +- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index e69de29..f87c87d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,31 @@ +name: Deploy to Dokku + +on: + push: + branches: ["master"] + paths-ignore: + - .gitignore + - README.md + - LICENSE + +jobs: + docker: + strategy: + matrix: + arch: ["ubuntu-latest"] + runs-on: ${{ matrix.arch }} + + # Steps to run + steps: + # Checkout the repo + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Deploy to Dokku + - name: Push to dokku + uses: dokku/github-action@master + with: + git_remote_url: "ssh://dokku@10.0.50.136:22/bat" + ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2c6efe4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Stage 1: Build the application +FROM maven:3.9.8-eclipse-temurin-17-alpine AS builder + +# Set the working directory +WORKDIR /home/container + +# Copy the source code +COPY . . + +# Build the jar +RUN mvn package -q -Dmaven.test.skip -DskipTests -T2C + +# Stage 2: Create the final lightweight image +FROM eclipse-temurin:17.0.11_9-jre-focal + +# Set the working directory +WORKDIR /home/container + +# Copy the built jar file from the builder stage +COPY --from=builder /home/container/target/YetAnotherBeatSaberTracker.jar . + +# Export the port +ENV PORT=7500 +EXPOSE $PORT + +# Run the jar file +CMD java -jar YetAnotherBeatSaberTracker.jar -Djava.awt.headless=true \ No newline at end of file diff --git a/pom.xml b/pom.xml index 7ef81f6..273f609 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ cc.fascinated YetAnotherBeatSaberTracker - 1.0-SNAPSHOT + 1.0 org.springframework.boot