Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
deploy to ws' server
Browse files Browse the repository at this point in the history
  • Loading branch information
dntjd1097 committed Jan 24, 2024
1 parent 742f686 commit 6d6125c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
64 changes: 31 additions & 33 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
name: Deploy to cloudtype
name: Python Docker Host Runner

on:
push:
branches:
- master
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
deploy:
runs-on: ubuntu-latest
build:
runs-on: [self-hosted, linux, x64]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Connect deploy key
uses: cloudtype-github-actions/connect@v1
with:
token: ${{ secrets.CLOUDTYPE_TOKEN }}
ghtoken: ${{ secrets.GHP_TOKEN }}
- name: Deploy
uses: cloudtype-github-actions/deploy@v1
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
with:
token: ${{ secrets.CLOUDTYPE_TOKEN }}
project: dntjd1097/responsive-slack-bot
stage: main
yaml: >
name: responsive-slack-bot
python-version: 3.9

- name: Build Docker image
run: sudo docker build -f Dockerfile -t notions_slack_bot_docker_image .
working-directory: .

app: [email protected]
- name: Stop previous Docker container
run: sudo docker stop notions_slack_bot_docker_container || true
continue-on-error: true

options:
env:
- name: FLASK_ENV
value: production
- name: SLACK_BOT_TOKEN
value: ${{ secrets.SLACK_BOT_TOKEN }}
- name: SLACK_APP_TOKEN
value: ${{ secrets.SLACK_APP_TOKEN }}
start: python slack.py
context:
git:
url: [email protected]:${{ github.repository }}.git
ref: ${{ github.ref }}
- name: Remove previous Docker container
run: sudo docker rm notions_slack_bot_docker_container || true
continue-on-error: true
- name: Run Docker container
run: |
sudo docker run -d --name notions_slack_bot_docker_container \
-e SLACK_APP_TOKEN=${{ secrets.SLACK_APP_TOKEN }} \
-e SLACK_BOT_TOKEN=${{ secrets.SLACK_BOT_TOKEN }} \
notions_slack_bot_docker_image
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.9.7
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "slack.py"]

0 comments on commit 6d6125c

Please sign in to comment.