-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Hufsthon2024Oeteco/FE
- Loading branch information
Showing
4 changed files
with
111 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,50 @@ | ||
name: Deploy Vite React App to k3s | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build the Vite app | ||
run: npm run build | ||
|
||
- name: Build Docker image | ||
run: docker build -t ${{ secrets.DOCKER_REGISTRY }}/oeteco_front:latest . | ||
|
||
- name: Push Docker image | ||
run: docker push ${{ secrets.DOCKER_REGISTRY }}/oeteco_front:latest | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Set up KUBECONFIG | ||
run: | | ||
mkdir $HOME/.kube | ||
echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config | ||
- name: Install kubectl | ||
uses: azure/setup-kubectl@v3 | ||
with: | ||
version: 'latest' | ||
|
||
- name: Rollout restart the deployment | ||
run: | | ||
kubectl rollout restart -n lgtu deployments/oeteco-front |
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,27 @@ | ||
server { | ||
listen 80 default_server; | ||
|
||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
|
||
location ~* \.(?:manifest|appcache|html?|xml|json)$ { | ||
expires -1; | ||
} | ||
|
||
location ~* \.(?:css|js)$ { | ||
try_files $uri =404; | ||
expires 1y; | ||
access_log off; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
# 파일 확장자를 포함하는 모든 경로 (예, /devicesFile.js) | ||
location ~ ^.+\..+$ { | ||
try_files $uri =404; | ||
} | ||
|
||
# 파일 확장자가 없는 모든 경로 (예, /devices) | ||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |
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,5 @@ | ||
FROM nginx:alpine | ||
COPY build /usr/share/nginx/html | ||
COPY default.conf /etc/nginx/conf.d/default.conf | ||
EXPOSE 80 | ||
CMD ["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