From fce9b8c9fdc09069cb41d2dfa2f545a88e85c6cc Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Wed, 19 Jun 2024 22:06:10 -0400 Subject: [PATCH] Dockerfile --- API/.gitea/workflows/deploy.yml | 35 +++++++++++++++++++++++++++++++++ API/Dockerfile | 22 +++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 API/.gitea/workflows/deploy.yml create mode 100644 API/Dockerfile diff --git a/API/.gitea/workflows/deploy.yml b/API/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..e41df50 --- /dev/null +++ b/API/.gitea/workflows/deploy.yml @@ -0,0 +1,35 @@ +name: Deploy + +on: + push: + branches: ["master"] + paths: [".gitea/workflows/deploy.yml", "!README.md"] + +jobs: + docker: + strategy: + matrix: + java-version: ["17"] + maven-version: ["3.8.5"] + runs-on: "ubuntu-latest" + + # Steps to run + steps: + # Checkout the repo + - name: Checkout + uses: actions/checkout@v4 + + # Setup Java and Maven + - name: Set up JDK and Maven + uses: s4u/setup-maven-action@v1.12.0 + with: + java-version: ${{ matrix.java-version }} + distribution: "zulu" + maven-version: ${{ matrix.maven-version }} + + # Deploy to Dokku + - name: Deploy to Dokku + uses: dokku/github-action@master + with: + git_remote_url: "ssh://dokku@10.10.3.28:22/textpurify-api" + ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} \ No newline at end of file diff --git a/API/Dockerfile b/API/Dockerfile new file mode 100644 index 0000000..3f11a10 --- /dev/null +++ b/API/Dockerfile @@ -0,0 +1,22 @@ +FROM maven:3.8.5-openjdk-17-slim + +# Set the working directory +WORKDIR /home/container + +# Copy project files +COPY . . + +# Build the app +RUN mvn clean package -q -DskipTests -T4C + +# Exposting on port 80 so we can +# access via a reverse proxy for Dokku +ENV HOSTNAME "0.0.0.0" +EXPOSE 80 +ENV PORT 80 + +# We're running in production +ENV APP_ENV "production" + +# Start the app +CMD ["java", "-jar", "target/TextPurify-API.jar"] \ No newline at end of file