Skip to content

Commit 7ff53d7

Browse files
authored
Merge pull request #22 from mjerta/develop
HC-142-adding-github-workflows
2 parents a035de5 + a5ab346 commit 7ff53d7

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.github/workflows/deploy.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: My Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
branches:
10+
- main
11+
- develop
12+
workflow_dispatch: # Enables manual triggering
13+
14+
jobs:
15+
deploy-to-production:
16+
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Deploy to production
20+
uses: johnbeynon/[email protected]
21+
with:
22+
service-id: ${{ secrets.PRODUCTION_RENDER_SERVICE_ID }}
23+
api-key: ${{ secrets.PRODUCTION_RENDER_API_KEY }}
24+
wait-for-success: true
25+
26+
deploy-to-develop:
27+
if: github.ref == 'refs/heads/develop' || github.event_name == 'workflow_dispatch'
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Deploy to develop
31+
uses: johnbeynon/[email protected]
32+
with:
33+
service-id: ${{ secrets.STAGING_RENDER_SERVICE_ID }}
34+
api-key: ${{ secrets.STAGING_RENDER_API_KEY }}
35+
wait-for-success: true

Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use an official Maven image to build the application
2+
FROM maven:3.9.8-amazoncorretto-21 AS build
3+
4+
# Set the working directory inside the container
5+
WORKDIR /app
6+
7+
# Copy the pom.xml file and download dependencies
8+
COPY pom.xml .
9+
RUN mvn dependency:go-offline -B
10+
11+
# Copy the source code and build the application
12+
COPY src ./src
13+
RUN mvn clean package -DskipTests
14+
15+
# Use an official Amazon Corretto runtime as a parent image
16+
FROM amazoncorretto:21
17+
18+
# Set the working directory inside the container
19+
WORKDIR /app
20+
21+
# Copy the JAR file from the build stage
22+
COPY --from=build /app/target/hotel-california-backend-0.0.1-SNAPSHOT.jar app.jar
23+
24+
# Command to run the JAR file
25+
ENTRYPOINT ["java", "-jar", "app.jar"]

0 commit comments

Comments
 (0)