Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
Accelerator
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Type
/
to search
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
9git9git
/
fastapi_deploy_tutorial
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Files
Expand file tree
main
Breadcrumbs
fastapi_deploy_tutorial
/
Dockerfile
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
47 lines (37 loc) · 1.99 KB
main
Breadcrumbs
fastapi_deploy_tutorial
/
Dockerfile
Copy path
Top
File metadata and controls
Code
Blame
47 lines (37 loc) · 1.99 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM python:3.9-slim
# 시스템 패키지 업데이트 및 필요한 의존성 설치
# - apt-get update: Ubuntu/Debian 패키지 목록 최신화
# - build-essential: C/C++ 컴파일러 등 기본 빌드 도구 설치
# (일부 Python 패키지는 설치 시 C/C++ 코드 컴파일이 필요하며, 이를 위한 도구)
# - curl: URL을 통해 데이터를 전송하는 도구 설치
# - rm -rf: 패키지 캐시를 삭제하여 이미지 크기 최적화
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Poetry 설치 시 네트워크 타임아웃 설정
ENV POETRY_HTTP_TIMEOUT=120
# Poetry 설치 및 PATH 설정
# - curl로 Poetry 설치 스크립트 다운로드 및 실행
# - ln -s: Poetry 실행 파일의 심볼릭 링크를 생성하여 전역 접근 가능하게 함
# (심볼릭 링크는 원본 파일을 가리키는 바로가기와 같은 것으로,
# /root/.local/bin/poetry를 /usr/local/bin/poetry에서도 접근 가능하게 함)
RUN curl -sSL https://install.python-poetry.org | python3 - && \
ln -s /root/.local/bin/poetry /usr/local/bin/poetry
# Poetry 가상환경 생성 비활성화 (Docker 컨테이너 내부에서는 불필요)
RUN poetry config virtualenvs.create false
# 의존성 파일만 먼저 복사 및 설치 (레이어 캐싱 최적화)
# --only main: 개발 의존성 제외하고 주요 의존성만 설치
# --no-root: 현재 프로젝트를 설치하지 않고 의존성만 설치 (캐싱 최적화)
# --no-interaction: 사용자 입력 없이 자동 설치
COPY pyproject.toml poetry.lock* ./
RUN poetry install --only main --no-root --no-interaction
# 모든 애플리케이션 코드를 컨테이너로 복사
COPY . .
EXPOSE 8000
# Python 경로에 현재 디렉토리 추가
ENV PYTHONPATH=/app
# FastAPI 애플리케이션 실행
# app.main:app은 app 패키지의 main 모듈에서 app 인스턴스를 찾아 실행
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
You can’t perform that action at this time.