-
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
thongdanghoang
committed
Jun 12, 2024
1 parent
166dbe8
commit 4432c49
Showing
7 changed files
with
108 additions
and
3 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,67 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- "release/*" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Extract version from branch name | ||
run: echo "VERSION=${GITHUB_REF#refs/heads/release/}" >> $GITHUB_ENV | ||
- name: Set up JDK 11 for x64 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
architecture: x64 | ||
- name: Build with Maven | ||
run: cd resource-server && mvn --batch-mode --update-snapshots verify | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
- run: cd frontend && npm ci | ||
- run: cd frontend && npm run build | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Build and push backend | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./resource-server | ||
file: ./resource-server/Dockerfile | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: "${{ secrets.DOCKERHUB_USERNAME }}/isc-301-services:${{ env.VERSION }}" | ||
build-args: | | ||
MYSQL_USER=${{ secrets.MYSQL_USER }} | ||
MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }} | ||
MAILGUN_DOMAIN_NAME=${{ secrets.MAILGUN_DOMAIN_NAME }} | ||
MAILGUN_API_KEY=${{ secrets.MAILGUN_API_KEY }} | ||
TWILIO_ACCOUNT_SID=${{ secrets.TWILIO_ACCOUNT_SID }} | ||
TWILIO_AUTH_TOKEN=${{ secrets.TWILIO_AUTH_TOKEN }} | ||
TWILIO_SERVICE_SID=${{ secrets.TWILIO_SERVICE_SID }} | ||
GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} | ||
GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }} | ||
- | ||
name: Build and push frontend | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./frontend | ||
file: ./frontend/Dockerfile | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: "${{ secrets.DOCKERHUB_USERNAME }}/isc-301-web:${{ env.VERSION }}" |
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
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 |
---|---|---|
|
@@ -37,4 +37,5 @@ npm-debug.log | |
yarn-error.log | ||
|
||
# React related | ||
/build/ | ||
/build/ | ||
dist |
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,13 @@ | ||
FROM nginx:alpine | ||
|
||
# Copy custom configuration file from the current directory | ||
COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
# Remove default nginx static assets | ||
RUN rm -rf /usr/share/nginx/html/* | ||
|
||
# Copy static assets from builder stage | ||
COPY dist /usr/share/nginx/html | ||
|
||
# Containers run nginx with global directives and daemon off | ||
ENTRYPOINT ["nginx", "-g", "daemon off;"] |
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
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
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 |
---|---|---|
@@ -1,3 +1,24 @@ | ||
FROM openjdk:11 AS runstage | ||
FROM openjdk:11 AS runstage | ||
ARG MYSQL_USER | ||
ARG MYSQL_PASSWORD | ||
ARG MAILGUN_DOMAIN_NAME | ||
ARG MAILGUN_API_KEY | ||
ARG TWILIO_ACCOUNT_SID | ||
ARG TWILIO_AUTH_TOKEN | ||
ARG TWILIO_SERVICE_SID | ||
ARG GOOGLE_CLIENT_ID | ||
ARG GOOGLE_CLIENT_SECRET | ||
ENV MYSQL_USER=$MYSQL_USER | ||
ENV MYSQL_PASSWORD=$MYSQL_PASSWORD | ||
ENV MAILGUN_DOMAIN_NAME=$MAILGUN_DOMAIN_NAME | ||
ENV MAILGUN_API_KEY=$MAILGUN_API_KEY | ||
ENV TWILIO_ACCOUNT_SID=$TWILIO_ACCOUNT_SID | ||
ENV TWILIO_AUTH_TOKEN=$TWILIO_AUTH_TOKEN | ||
ENV TWILIO_SERVICE_SID=$TWILIO_SERVICE_SID | ||
ENV GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID | ||
ENV GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET | ||
COPY target/*.jar app.jar | ||
ENTRYPOINT ["java", "-jar", "/app.jar"] | ||
COPY target/*.jar app.jar | ||
ENTRYPOINT ["java", "-jar", "/app.jar"] |