-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
프론트엔드 CI / CD 스크립트 추가
- Loading branch information
Showing
4 changed files
with
147 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,37 @@ | ||
name: frontend-deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop-frontend | ||
|
||
jobs: | ||
deploy: | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- name: Log in to Dockerhub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: allow ubuntu to access actions-runner | ||
run: | | ||
sudo chown -R ubuntu:ubuntu ~/actions-runner | ||
- name: grant permission to docker-compose | ||
run: | | ||
sudo chmod +x ./frontend/docker-compose-fe.yml | ||
- name: docker compose down | ||
run: | | ||
docker compose -f ./frontend/docker-compose-fe.yml down | ||
- name: docker compose pull | ||
run: | | ||
docker compose -f ~/frontend/docker-compose-fe.yml pull | ||
- name: docker compose up | ||
run: | | ||
docker compose -f ~/frontend/docker-compose-fe.yml up -d |
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: frontend-integration | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop-frontend | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./frontend | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: develop-frontend | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20.15.0' | ||
|
||
- name: Create .env file | ||
run: | | ||
echo "BASE_URL=${{ secrets.BASE_URL }}" > .env | ||
- name: Install Dependencies | ||
run: npm install --frozen-lockfile | ||
|
||
- name: Build static file | ||
run: npm run build | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker buildx build ./ --platform=linux/arm64 -t ${{ secrets.DOCKER_USERNAME }}/mouda-fe:latest | ||
- name: Log in to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Push Docker image to DockerHub | ||
run: docker push ${{ secrets.DOCKER_USERNAME }}/mouda-fe: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,8 @@ | ||
FROM nginx:latest | ||
|
||
COPY dist /usr/share/nginx/html | ||
COPY conf.d /etc/nginx/conf.d | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
server { | ||
listen 80; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
location /v1/ { | ||
proxy_pass http://localhost:8080; | ||
proxy_set_header HOST $http_host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_set_header X-NginX-Proxy true; | ||
proxy_redirect off; | ||
charset utf-8; | ||
} | ||
|
||
#error_page 404 /404.html; | ||
|
||
# redirect server error pages to the static page /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | ||
# | ||
#location ~ \.php$ { | ||
# proxy_pass http://127.0.0.1; | ||
#} | ||
|
||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | ||
# | ||
#location ~ \.php$ { | ||
# root html; | ||
# fastcgi_pass 127.0.0.1:9000; | ||
# fastcgi_index index.php; | ||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; | ||
# include fastcgi_params; | ||
#} | ||
|
||
# deny access to .htaccess files, if Apache's document root | ||
# concurs with nginx's one | ||
# | ||
#location ~ /\.ht { | ||
# deny all; | ||
#} | ||
} |