From 6ae6978d68623653ef235f3f07ed78985d2e8711 Mon Sep 17 00:00:00 2001 From: unroll3677 Date: Tue, 15 Jul 2025 15:22:17 +0200 Subject: [PATCH] Update Dockerfile --- Dockerfile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 324712f..db6c00b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"]