diff --git a/.github/workflows/curaz-cicd.yml b/.github/workflows/curaz-cicd.yml new file mode 100644 index 0000000..0a3e74f --- /dev/null +++ b/.github/workflows/curaz-cicd.yml @@ -0,0 +1,72 @@ +name: CURAZ CI/CD Pipeline + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + echo "::add-path::${HOME}/.local/bin" + + - name: Install dependencies + run: poetry install + + - name: Export requirements.txt + run: poetry export -f requirements.txt --output requirements.txt + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build Docker image + run: docker build -t curaz/api-server:latest . + + - name: Push Docker image + run: docker push curaz/api-server:latest + + deploy: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Deploy to server + uses: appleboy/ssh-action@v0.1.3 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_PASSWORD }} + password: ${{ secrets.SERVER_REMOTE_USER }} + script: | + cd /path/to/your/docker-compose-directory + docker-compose pull + docker-compose up -d diff --git a/.gitignore b/.gitignore index 2dff229..0f7beb5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ __pycache__ requirements.txt poetry.lock -.python-version \ No newline at end of file +.python-version diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..36435ac --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10.8 diff --git a/pyproject.toml b/pyproject.toml index 3e63bcf..a485837 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "curaz-api-server" version = "0.1.0" -description = "" +description = "BOAZ API SERVER" authors = ["Changmin Kim "] readme = "README.md" @@ -13,4 +13,3 @@ fastapi = "^0.111.0" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" -