rueki
FastAPI 어플리케이션 Docker로 배포 본문
728x90
반응형
- DockerFile 작성
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
ENV APP_MODULE app.app:app
COPY requirements.txt /app
RUN pip install --upgrade pip && \
pip install -r /app/requirements.txt
COPY ./ /app
* uvicorn-gunicorn-fastapi 도커 템플릿
https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker
GitHub - tiangolo/uvicorn-gunicorn-fastapi-docker: Docker image with Uvicorn managed by Gunicorn for high-performance FastAPI we
Docker image with Uvicorn managed by Gunicorn for high-performance FastAPI web applications in Python 3.6 and above with performance auto-tuning. Optionally with Alpine Linux. - GitHub - tiangolo/u...
github.com
- docker build
docker build -t fastapi-app .
-t 옵션은 이미지 태그를 말함
- Local에서 docker 실행하기
docker run -p 8000:80 -e ENVIRONMENT=production -e DATABASE_ URL=sqlite://./app.db fastapi-app
-e 는 환경 변수 설정
-p 는 local port 할당
그 외 소스코드
https://github.com/wonkicho/fastapi_for_MLmodels/tree/main/ch10_Deploying_fastapi/project
GitHub - wonkicho/fastapi_for_MLmodels
Contribute to wonkicho/fastapi_for_MLmodels development by creating an account on GitHub.
github.com
728x90
반응형
Comments