Update Dockerfile

This commit is contained in:
unroll3677
2025-07-15 15:22:17 +02:00
committed by GitHub
parent 4c043a596b
commit 6ae6978d68

View File

@@ -1,17 +1,22 @@
# Use an appropriate base image with Python pre-installed
FROM alpine:3.18
# Step 1: Use an official, slim Python image as a base
# 'slim' is a good balance between size and functionality.
FROM python:3.11-slim
# Set the working directory inside the container
WORKDIR /app
# Copy the entire current directory into the container at /app
COPY . /app
# Step 2: Copy only the requirements file
# This makes optimal use of Docker's layer caching.
COPY requirements.txt .
# Install any Python dependencies
# Step 3: Install the dependencies
# The --no-cache-dir option keeps the image smaller.
RUN pip install --no-cache-dir -r requirements.txt
RUN apk add python3
RUN apk add py3-pip
RUN pip install -r requirements.txt
# Step 4: Now, copy the rest of the application code
# Because the code changes more often than the dependencies, this step is placed later.
COPY . .
# Run Python script
CMD ["python", "main.py"]
# Step 5: Execute the correct Python script
# Note the correct filename.
CMD ["python3", "masto-rss.py"]