Skip to content

feat(infra): add Dockerfile for API container #1

feat(infra): add Dockerfile for API container

feat(infra): add Dockerfile for API container #1

Workflow file for this run

name: CI/CD
on:
push:
branches: [main]
concurrency:
group: deploy-production
cancel-in-progress: false
jobs:
lint:
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- run: pip install -e ".[dev]" pyright
- run: pyright src/
test:
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: pyproject.toml
- run: pip install -e ".[dev]"
- run: pytest -v --junitxml=test-results.xml
- uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: test-results.xml
deploy:
needs: [lint, test]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout credentials
uses: actions/checkout@v4
with:
repository: BCSDLab/bcsdlab-credentials
ssh-key: ${{ secrets.CONFIG_REPO_PEM_KEY }}
path: credentials
persist-credentials: false
- name: Upload credentials to server
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: 22222
source: "credentials/bcsd-api/backend/*"
target: "~/BCSD_API"
strip_components: 3
- name: Clean up credentials from runner
if: always()
run: rm -rf credentials
- name: Deploy
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: 22222
script: |
cd ~/BCSD_API
git pull origin main
bash infra/scripts/deploy.sh