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
Recommended Workflow for Python Project with Docker
1. Set Up Project Directory
mkdir my_project
cd my_project
2. Create Virtual Environment (Optional for Local Development)
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
3. Install Dependencies Locally (Optional for Local Development)
pip install <package1><package2> ...
4. Create Requirements File
pip freeze > requirements.txt
5. Create Dockerfile
# Use an official Python runtime as a parent imageFROM python:3.9-slim
# Set the working directory in the containerWORKDIR /app
# Copy the current directory contents into the container at /appCOPY . /app
# Install any needed packages specified in requirements.txtRUN pip install --no-cache-dir -r requirements.txt
# Make port 80 available to the world outside this containerEXPOSE 80
# Run app.py when the container launchesCMD ["python", "app.py"]