Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HC-142-adding-github-workflows #22

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
with:
service-id: ${{ secrets.STAGING_RENDER_SERVICE_ID }}
api-key: ${{ secrets.STAGING_RENDER_API_KEY }}
wait-for-success: true
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Loading