Skip to content

Commit cac96f8

Browse files
release
1 parent 166dbe8 commit cac96f8

File tree

18 files changed

+5538
-22
lines changed

18 files changed

+5538
-22
lines changed

.github/workflows/docker.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- "release/*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
-
13+
name: Checkout
14+
uses: actions/checkout@v4
15+
- name: Extract version from branch name
16+
run: echo "VERSION=${GITHUB_REF#refs/heads/release/}" >> $GITHUB_ENV
17+
- name: Set up JDK 11 for x64
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: '11'
21+
distribution: 'temurin'
22+
architecture: x64
23+
- name: Build with Maven
24+
run: cd resource-server && mvn --batch-mode --update-snapshots verify
25+
- name: Use Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '20.x'
29+
- run: cd frontend && npm i
30+
- run: cd frontend && npm run build
31+
-
32+
name: Login to Docker Hub
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ secrets.DOCKERHUB_USERNAME }}
36+
password: ${{ secrets.DOCKERHUB_TOKEN }}
37+
-
38+
name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
-
41+
name: Build and push backend
42+
uses: docker/build-push-action@v5
43+
with:
44+
context: ./resource-server
45+
file: ./resource-server/Dockerfile
46+
push: true
47+
platforms: linux/amd64,linux/arm64
48+
tags: "${{ secrets.DOCKERHUB_USERNAME }}/isc-301-services:${{ env.VERSION }}"
49+
build-args: |
50+
MYSQL_USER=${{ secrets.MYSQL_USER }}
51+
MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }}
52+
MAILGUN_DOMAIN_NAME=${{ secrets.MAILGUN_DOMAIN_NAME }}
53+
MAILGUN_API_KEY=${{ secrets.MAILGUN_API_KEY }}
54+
TWILIO_ACCOUNT_SID=${{ secrets.TWILIO_ACCOUNT_SID }}
55+
TWILIO_AUTH_TOKEN=${{ secrets.TWILIO_AUTH_TOKEN }}
56+
TWILIO_SERVICE_SID=${{ secrets.TWILIO_SERVICE_SID }}
57+
GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}
58+
GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}
59+
-
60+
name: Build and push frontend
61+
uses: docker/build-push-action@v5
62+
with:
63+
context: ./frontend
64+
file: ./frontend/Dockerfile
65+
push: true
66+
platforms: linux/amd64,linux/arm64
67+
tags: "${{ secrets.DOCKERHUB_USERNAME }}/isc-301-web:${{ env.VERSION }}"

docke-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: "3.9"
22
services:
33
# mysql database
44
mysql-db:
5+
container_name: n3tk-db
56
image: mysql:latest
67
environment:
78
MYSQL_ROOT_PASSWORD: root
@@ -10,6 +11,7 @@ services:
1011
- "3306:3306"
1112
# spring boot app
1213
spring-boot-app:
14+
container_name: n3tk-app
1315
build: resource-server
1416
environment:
1517
MYSQL_USER: ${MYSQL_USER}

frontend/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VITE_API_URL=http://localhost:8080
1+
VITE_API_URL=/isc-301/api

frontend/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ npm-debug.log
3737
yarn-error.log
3838

3939
# React related
40-
/build/
40+
/build/
41+
dist

frontend/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM nginx:alpine
2+
3+
# Copy custom configuration file from the current directory
4+
COPY nginx.conf /etc/nginx/conf.d/default.conf
5+
6+
# Remove default nginx static assets
7+
RUN rm -rf /usr/share/nginx/html/*
8+
9+
# Copy static assets from builder stage
10+
COPY dist /usr/share/nginx/html
11+
12+
# Containers run nginx with global directives and daemon off
13+
ENTRYPOINT ["nginx", "-g", "daemon off;"]

frontend/nginx.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
server {
2+
listen 80;
3+
4+
location / {
5+
root /usr/share/nginx/html;
6+
index index.html index.htm;
7+
try_files $uri $uri/ /index.html =404;
8+
}
9+
10+
error_page 500 502 503 504 /50x.html;
11+
12+
location = /50x.html {
13+
root /usr/share/nginx/html;
14+
}
15+
}

0 commit comments

Comments
 (0)