ci: 수동트리거 추가 #21
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
name: Build Image | |
on: | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
jobs: | |
cicd: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build Container Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: geunsam2/korailbot:latest | |
- | |
name: SSH Remote Commands | |
uses: appleboy/[email protected] | |
with: | |
host: opc.modutech.win | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: 22 | |
timeout: 40s # 30초 기본 | |
script: | | |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
docker pull geunsam2/korailbot:latest | |
docker rm -f korailreserve | |
docker run -it -d \ | |
-p 8080:8080 \ | |
--restart always \ | |
-e USERID='${{ secrets.ADMIN_USERID }}' \ | |
-e USERPW='${{ secrets.ADMIN_PASSWD}}' \ | |
-e BOTTOKEN='${{ secrets.TELEGRAM_BOTTOKEN }}' \ | |
-e ALLOW_LIST='${{ secrets.ALLOW_LIST }}' \ | |
--name korailreserve \ | |
geunsam2/korailbot:latest |