-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (40 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
54 lines (40 loc) · 1.37 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Use an official Python runtime as a parent image
FROM python:3.12-slim
# Install gosu for user switching at runtime
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /app
# Copy the dependencies file to the working directory
COPY requirements.txt .
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code to the working directory
COPY app.py ./
COPY static ./static
COPY templates ./templates
COPY clients ./clients
COPY hardcover ./hardcover
COPY version.txt ./version.txt
# remove this if becomes obsolete
COPY hashing.py ./
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Make port 5000 available to the world outside this container
EXPOSE 5000
# Production env
ENV ADDRESS=0.0.0.0
ENV PORT=5000
ENV ACCESS_LOGFILE=/dev/null
# Force Docker to use root /data instead of relative ./data
ENV DATA_PATH=/data
# Create the data directory explicitly so we can chown it later
RUN mkdir -p $DATA_PATH
# Set the entrypoint to our script
ENTRYPOINT ["/app/entrypoint.sh"]
CMD exec hypercorn --bind ${ADDRESS}:${PORT} \
--workers 1 \
--worker-class asyncio \
--access-logfile ${ACCESS_LOGFILE} \
--error-logfile - \
--log-level info app:app \
--graceful-timeout 5