Flask 배포용 Dockerfile·.gitignore 추가

- Dockerfile: python:3.12-slim 기반. requirements.txt를 먼저 설치해
  레이어 캐시를 활용하고, 비루트(appuser)로 실행. 배포 규격대로
  0.0.0.0:8080 포트 노출(EXPOSE 8080). sample/Dockerfile 구조를
  파이썬 플라스크용으로 변환.
- .gitignore: __pycache__·*.pyc, 가상환경(.venv 등), .env 등
  파이썬/환경변수 산출물 제외.
This commit is contained in:
2026-06-16 17:43:47 +09:00
parent 6847e8fa89
commit 332ce2caa4
2 changed files with 50 additions and 0 deletions

26
.gitignore vendored Normal file
View File

@@ -0,0 +1,26 @@
# Python
__pycache__/
*.py[cod]
*.egg-info/
.eggs/
build/
dist/
# 가상환경
.venv/
venv/
env/
# 환경변수(자격증명 포함) — 절대 커밋 금지
.env
.env.*
!.env.example
# 테스트/캐시
.pytest_cache/
.mypy_cache/
.coverage
htmlcov/
# OS / 에디터
.DS_Store

24
Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
# 로컬(podman)과 Kubero 자동빌드가 공유하는 단일 Dockerfile.
# - 로컬: podman build -t maze-runner . && podman run --rm -p 8080:8080 maze-runner
# - 배포: git push → Kubero가 이 Dockerfile로 빌드/배포 (http://<앱이름>.apps.bokdev.in)
FROM python:3.12-slim
WORKDIR /app
# 의존성 레이어 캐시
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# 앱 소스
COPY . .
ENV PYTHONUNBUFFERED=1 \
PORT=8080
# 배포 규격: 0.0.0.0 의 8080 포트
EXPOSE 8080
# 비루트 실행
RUN useradd --create-home --uid 10001 appuser
USER appuser
CMD ["python", "main.py"]