Fred808 commited on
Commit
e480b68
·
verified ·
1 Parent(s): 8f8c2f2

Upload Dockerfile (2)

Browse files
Files changed (1) hide show
  1. Dockerfile (2) +48 -0
Dockerfile (2) ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the Bullseye-based image to have access to apt-get
2
+ FROM python:3.11-slim-bullseye
3
+
4
+ # Set the working directory
5
+ WORKDIR /app
6
+
7
+ # Create necessary directories for the application
8
+ RUN mkdir -p /app/downloads /app/extracted /app/state
9
+
10
+ # Copy the Python requirements file
11
+ COPY requirements.txt .
12
+
13
+ # Add non-free repository and install system dependencies
14
+ RUN echo "deb http://deb.debian.org/debian bullseye main contrib non-free" > /etc/apt/sources.list.d/non-free.list && \
15
+ apt-get update && \
16
+ apt-get install -y --no-install-recommends unrar && \
17
+ pip install --no-cache-dir -r requirements.txt && \
18
+ apt-get clean && \
19
+ rm -rf /var/lib/apt/lists/*
20
+
21
+ # Copy the rest of the application code
22
+ COPY main.py .
23
+ COPY docker-entrypoint.sh .
24
+
25
+ # Make the entrypoint script executable
26
+ RUN chmod +x docker-entrypoint.sh
27
+
28
+ # Expose volumes for persistent data
29
+ VOLUME ["/app/extracted", "/app/state"]
30
+
31
+ # Create a non-root user and switch to it
32
+ RUN useradd -m -s /bin/bash -u 1000 user && \
33
+ chown -R user:user /app
34
+
35
+ USER user
36
+
37
+ # Set environment variables for the application
38
+ ENV PYTHONUNBUFFERED=1
39
+ ENV HF_TOKEN=""
40
+ ENV SOURCE_REPO="Fred808/BG1"
41
+ ENV DOWNLOAD_FOLDER=/app/downloads
42
+ ENV EXTRACT_FOLDER=/app/extracted
43
+ ENV STATE_FOLDER=/app/state
44
+
45
+ # Set the entrypoint and default command
46
+ ENTRYPOINT ["./docker-entrypoint.sh"]
47
+ CMD ["python", "main.py"]
48
+