Dockerfile31 lines · 676 chars FROM python:3.11-slim-bullseye
# Build-time dependencies
RUN apt-get update -y && \
apt-get install -y --no-install-recommends build-essential libssl-dev libffi-dev ca-certificates && \
rm -rf /var/lib/apt/lists/*
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install Flit build backend and CLI
RUN pip install --no-cache-dir "flit_core>=3.11,<4" "flit>=3.11,<4"
# Copy sources
COPY pyproject.toml .
COPY . .
# Build the project
RUN flit build
# Install the built package
RUN pip install --no-cache-dir dist/*.whl
# Expose port for potential Flask apps
EXPOSE 5000
# Default command to verify CLI
CMD ["python","-m","flask","--version"]