Lommds / Dockerfile
understanding's picture
Create Dockerfile
96c728b verified
raw
history blame
939 Bytes
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy the requirements file first to leverage Docker cache
COPY requirements.txt .
# Install any needed packages specified in requirements.txt
# --no-cache-dir reduces image size, --upgrade pip ensures pip is up-to-date
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy all files from the build context (app.py, etc.) into the working directory
COPY . .
# Create necessary directories that the app will use, as per user guidance
# 'data' for persistent items (template, font, config)
# 'downloads' for temporary raw images
# 'session' for the Telethon session file
RUN mkdir -p ./data ./downloads ./session && \
chmod -R 777 ./data ./downloads ./session
# Command to run the application when the container launches
CMD ["python", "app.py"]