mirror of
https://github.com/aserper/masto-rss.git
synced 2025-12-17 05:15:25 +00:00
Update Dockerfile
This commit is contained in:
25
Dockerfile
25
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"]
|
||||
|
||||
Reference in New Issue
Block a user