깃 이그노어 수정 #9
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out the repository code | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
# Set up Python environment | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
# Create and activate virtual environment, install dependencies | |
- name: Install dependencies | |
run: | | |
cd backend | |
python3 -m venv pig | |
source pig/bin/activate | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
# Build Docker image | |
- name: Build Docker image | |
run: | | |
cd backend | |
ls | |
docker build -t pig . | |
# Deploy Docker container | |
- name: Deploy Docker container | |
run: | | |
CONTAINER_ID=$(docker ps -q --filter ancestor=pig) | |
if [ -n "$CONTAINER_ID" ]; then | |
docker stop $CONTAINER_ID | |
docker rm $CONTAINER_ID | |
fi | |
docker run -d -p 8000:8000 pig |