-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbaeaaf
commit 676a4a2
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: WEMEET Backend Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- src/main/java/com/server/wordwaves/** | ||
- Dockerfile | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- src/main/java/com/server/wordwaves/** | ||
- Dockerfile | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Build and Deploy | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'corretto' | ||
|
||
- name: Make mvnw executable | ||
run: chmod +x ./mvnw | ||
|
||
- name: Build with Maven | ||
run: ./mvnw clean package -DskipTests | ||
|
||
- name: Build Docker image | ||
run: docker build -t quan0204/wordwaves-server:latest . | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Push Docker image to Docker Hub | ||
run: docker push quan0204/wordwaves-server:latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM maven:3.9.8-amazoncorretto-21 AS build | ||
|
||
WORKDIR /app | ||
COPY pom.xml . | ||
COPY src ./src | ||
|
||
# Xây dựng ứng dụng | ||
RUN mvn package -DskipTests | ||
|
||
FROM amazoncorretto:21.0.4 | ||
|
||
WORKDIR /app | ||
|
||
# Copy file jar từ build stage | ||
COPY --from=build /app/target/*.jar app.jar | ||
|
||
|
||
ENV SPRING_PROFILES_ACTIVE=prod | ||
|
||
ENTRYPOINT ["java", "-jar", "app.jar"] |