Skip to content

chore : cicd pipeline 수정 #4

chore : cicd pipeline 수정

chore : cicd pipeline 수정 #4

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: |
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