Skip to content

Commit

Permalink
👷 Init: CI/CD 세팅 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
yjsmk0902 committed May 17, 2024
1 parent 0a045bf commit b078818
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
23 changes: 8 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,24 @@ jobs:
with:
python-version: '3.9'

- name: Clean Docker system
run: docker system prune -a -f --volumes

- name: 의존성 설치
run: |
python -m venv venv
. venv/bin/activate
pip install -r requirements.txt
- name: 빌드 권한 설정
run: chmod +x ./docker-entrypoint.sh

- name: 도커 로그인
uses: docker/login-action@v2
- name: 빌드 하고 푸시
env:
USER: ${{ secrets.DOCKER_USERNAME }}
APP: ${{ secrets.DOCKER_APP_NAME }}
uses: mr-smithers-excellent/docker-build-push@v5
with:
image: $USER/$APP
tags: latest
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: 도커 이미지 생성 및 오리진에 푸시
env:
USER: ${{ secrets.DOCKER_USERNAME }}
APP: ${{ secrets.DOCKER_APP_NAME }}
run: |
docker build -t $USER/$APP -f ./Dockerfile .
docker push $USER/$APP:latest
CD:
runs-on: ubuntu-latest
needs: CI
Expand Down
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Use the official Python image from the Docker Hub
FROM python:3.9-slim

# 현재 디렉토리의 모든 파일들을 컨테이너의 /app 디렉토리에 복사한다.
COPY . /app

# Set the working directory in the container
WORKDIR /app

# Copy the requirements.txt file into the container
RUN pip install -r requirements.txt
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY . .

# Make port 5000 available to the world outside this container
EXPOSE 5000

# Command to run the application
CMD ["python", "app.py"]
CMD ["python3", "-m", "flask", "run", "--host=0.0.0.0"]

0 comments on commit b078818

Please sign in to comment.