diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..a3f03c9 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,23 @@ +name: Deploy +on: + workflow_run: + workflows: ["CI with Maven"] + branches: [main] + types: + - completed + +jobs: + on-success: + runs-on: ubuntu-latest + permissions: + deployments: write + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - uses: JorgeLNJunior/render-deploy@v1.4.5 + with: + service_id: ${{ secrets.RENDER_SERVICE_ID }} + api_key: ${{ secrets.RENDER_API_KEY }} + wait_deploy: true + github_deployment: true + deployment_environment: 'production' + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..880a524 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# Use an official Maven image as the base image +FROM maven:3.8.4-openjdk-17-slim AS build +# Set the working directory in the container +WORKDIR /app + +COPY pom.xml . +COPY src ./src + +# Build the application using Maven +RUN mvn clean package + +# Use an official OpenJDK image as the base image +FROM openjdk:21-slim +# Set the working directory in the container +WORKDIR /app + +# Copy the built JAR file from the previous stage to the container +COPY --from=build /app/target/springboot-0.0.1-SNAPSHOT.jar app.jar + +# Set the entry point to run your application +ENTRYPOINT ["java","-jar","/app/app.jar"] \ No newline at end of file