dockerize!
This commit is contained in:
41
Dockerfile-schedule
Normal file
41
Dockerfile-schedule
Normal file
@@ -0,0 +1,41 @@
|
||||
# Use Python slim image as base
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements.txt first to leverage Docker cache
|
||||
COPY requirements.txt .
|
||||
|
||||
# Install dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# System packages
|
||||
RUN apt update && apt install -y tzdata
|
||||
|
||||
# Timezone
|
||||
ENV TZ=Europe/Rome
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
# Copy application files
|
||||
COPY schedule.py .
|
||||
|
||||
# Copy entrypoint script and make it executable
|
||||
COPY entrypoint-schedule.sh .
|
||||
RUN chmod +x entrypoint-schedule.sh
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Required environment variables for schedule.py
|
||||
# These can be overridden at runtime using -e or --env-file
|
||||
# ENDPOINT_URL: The API endpoint to fetch plexts from
|
||||
ENV ENDPOINT_URL=""
|
||||
# MONGO_URI: MongoDB connection string
|
||||
ENV MONGO_URI=""
|
||||
# DB_NAME: MongoDB database name
|
||||
ENV COLLECTION_NAME=""
|
||||
|
||||
# Run the schedule script using the entrypoint script
|
||||
# Using JSON array form for proper signal handling
|
||||
CMD ["./entrypoint-schedule.sh"]
|
||||
Reference in New Issue
Block a user