From c53e1fd6bfc8dae09accb5e1e984fb3dbc8d437e Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Sun, 8 Sep 2024 16:19:15 -0400 Subject: [PATCH] Build files --- .gitea/workflows/deploy.yml | 31 +++++++++++++++++++++++++++++++ Dockerfile | 26 ++++++++++++++++++++++++++ pom.xml | 1 + 3 files changed, 58 insertions(+) create mode 100644 .gitea/workflows/deploy.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..3bb91bb --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,31 @@ +name: Deploy API + +on: + push: + branches: ["master"] + paths-ignore: + - README.md + - LICENSE + +jobs: + docker: + strategy: + matrix: + arch: ["ubuntu-latest"] + git-version: ["2.44.0"] + 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: Deploy to Dokku + uses: dokku/github-action@master + with: + git_remote_url: "ssh://dokku@10.10.3.28:22/tether" + 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..14f3616 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Stage 1: Build the application +FROM maven:3.9.6-eclipse-temurin-17-alpine AS builder + +# Set the working directory +WORKDIR /home/container + +# Copy the current directory contents into the container at /home/container +COPY . . + +# Build the jar +RUN mvn package -q -Dmaven.test.skip -DskipTests -T2C -s ./settings.xml + +# 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/Tether.jar . + +# We're running in production +ENV APP_ENV "production" + +# Run the jar file +CMD java -jar Tether.jar -Djava.awt.headless=true \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2d73586..9303e51 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,7 @@ + ${project.artifactId}