diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..68e443f --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,35 @@ +name: My Deploy + +on: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + workflow_dispatch: # Enables manual triggering + +jobs: + deploy-to-production: + if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - name: Deploy to production + uses: johnbeynon/render-deploy-action@v0.0.8 + with: + service-id: ${{ secrets.PRODUCTION_RENDER_SERVICE_ID }} + api-key: ${{ secrets.PRODUCTION_RENDER_API_KEY }} + wait-for-success: true + + deploy-to-develop: + if: github.ref == 'refs/heads/develop' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - name: Deploy to develop + uses: johnbeynon/render-deploy-action@v0.0.8 + with: + service-id: ${{ secrets.STAGING_RENDER_SERVICE_ID }} + api-key: ${{ secrets.STAGING_RENDER_API_KEY }} + wait-for-success: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dbc64ab --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# Use an official Maven image to build the application +FROM maven:3.9.8-amazoncorretto-21 AS build + +# Set the working directory inside the container +WORKDIR /app + +# Copy the pom.xml file and download dependencies +COPY pom.xml . +RUN mvn dependency:go-offline -B + +# Copy the source code and build the application +COPY src ./src +RUN mvn clean package -DskipTests + +# Use an official Amazon Corretto runtime as a parent image +FROM amazoncorretto:21 + +# Set the working directory inside the container +WORKDIR /app + +# Copy the JAR file from the build stage +COPY --from=build /app/target/hotel-california-backend-0.0.1-SNAPSHOT.jar app.jar + +# Command to run the JAR file +ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file