diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d81f775 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,24 @@ +# Ignore Git and GitHub files +.git +.github + +# Ignore all markdown files (README.md, etc.) +*.md + +# Ignore all log files +*.log + +# Ignore Python cache files +__pycache__ +*.pyc +*.pyo +*.pyd +.Python + +# Ignore Python virtual environment files +venv +env/ + +# Ignore common database files +*.sql +*.sqlite diff --git a/Dockerfile b/Dockerfile index 5cfcbcf..d4cef3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,15 @@ -# Dockerfile -FROM python:3.12-slim +# Stage 1: Use python:3.12 to install dependencies +FROM python:3.12 as builder WORKDIR /app COPY requirements.txt requirements.txt RUN pip install --no-cache-dir -r requirements.txt +# Stage 2: Use python:3.12-alpine and copy installed dependencies from builder stage +FROM python:3.12-alpine + +WORKDIR /app + +COPY --from=builder /usr/local /usr/local COPY . .