forked from JourneyDocker/Plex-Auto-Languages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (26 loc) · 1.13 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM python:3.13-alpine
# Set environment variables
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
CONTAINERIZED=True \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Install dependencies and clean up in a single layer to reduce image size
RUN apk --no-cache add curl tini tzdata
# Set up working directory and install Python dependencies
WORKDIR /app
COPY ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . /app/
# Define a mount point for configuration
VOLUME /config
# Healthcheck: First check readiness, then check health
# This way, Docker can detect when the service is ready to start receiving traffic and whether it remains healthy over time.
HEALTHCHECK --interval=30s --timeout=10s --start-period=2m --retries=3 \
CMD curl --silent --fail http://localhost:9880/ready || exit 1 && \
curl --silent --fail http://localhost:9880/health || exit 1
# Use tini as the init system to handle zombie processes and signal forwarding
ENTRYPOINT ["/sbin/tini", "--"]
# Define the default command
CMD ["python3", "main.py", "-c", "/config/config.yaml"]