Dockerfile30 lines · 914 chars FROM python:3.11-slim
# Basic Python environment
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Working directory for the app
WORKDIR /app
# System build tools (safe minimal set)
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy repository contents and build/install from source
COPY . .
# Ensure latest packaging tools and install the project from source
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install .
# create a tiny app to run
RUN printf '%s\n' 'from flask import Flask' 'app = Flask(__name__)' '@app.route("/")' 'def index():' ' return "Hello from Flask!"' '' 'if __name__ == "__main__":' ' app.run(host="0.0.0.0", port=5000)' > /app/app.py
# Expose the default Flask port
EXPOSE 5000
# Run a small demonstration app bundled with the repo
CMD ["python", "app.py"]