Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:
contents: read

jobs:
front-cicd:
front-cd:
runs-on: ubuntu-latest
steps:
# 저장소 코드를 체크아웃합니다. (PR 올린 코드를 가져오는 행위)
Expand All @@ -31,26 +31,16 @@ jobs:
- name: Build with npm
run: npm run build-only

- name: send file via ssh
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.FRONT_HOST }}
username: ${{ secrets.FRONT_HOST_USERNAME }}
key: ${{ secrets.FRONT_HOST_KEY }}
port: ${{ secrets.FRONT_HOST_PORT }}
source: "dist/*"
target: /home/${{ secrets.FRONT_HOST_USERNAME }}/
#
# - name: Create nginx.conf
# run: touch ./nginx.conf
# - run: echo "${{ secrets.NGINX_CONF }}" > ./nginx.conf
- name: Create nginx.conf
run: touch ./nginx.conf
- run: echo "${{ secrets.NGINX_CONF }}" > ./nginx.conf

## docker build & push to production
# - name: Docker build & push
# run: |
# docker login clap.kr-central-2.kcr.dev -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
# docker build -t ${{ secrets.DOCKER_FRONT_REPO }} .
# docker push ${{ secrets.DOCKER_FRONT_REPO }}
# docker build & push to production
- name: Docker build & push
run: |
docker login clap.kr-central-2.kcr.dev -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_FRONT_REPO }} .
docker push ${{ secrets.DOCKER_FRONT_REPO }}

## deploy
- name: Deploy
Expand All @@ -62,9 +52,6 @@ jobs:
key: ${{ secrets.FRONT_HOST_KEY }}
port: ${{ secrets.FRONT_HOST_PORT }}
script: |
sudo rm -rf /var/www/html/*
sudo cp -r dist/* /var/www/html/
sudo systemctl restart nginx
# docker rm -f taskflow-front
# docker image rm ${{ secrets.DOCKER_FRONT_REPO }} -f
# docker run --name taskflow-front -d -p 80:80 --restart on-failure ${{ secrets.DOCKER_FRONT_REPO }}
docker rm -f taskflow-front
docker image rm ${{ secrets.DOCKER_FRONT_REPO }} -f
docker run --name taskflow-front -d -p 80:80 -p 443:443 -v /etc/letsencrypt/:/etc/letsencrypt/ -v /etc/ssl/:/etc/ssl/ --restart on-failure ${{ secrets.DOCKER_FRONT_REPO }}
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
contents: read

jobs:
front-cicd:
front-ci:
runs-on: ubuntu-latest
steps:
# 저장소 코드를 체크아웃합니다. (PR 올린 코드를 가져오는 행위)
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY dist/. /usr/share/nginx/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]