Ari commited on
Commit
f9dd127
·
verified ·
1 Parent(s): f08cc93

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +52 -0
Dockerfile ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the specific Python 3.10 image as base
2
+ FROM docker.io/library/python:3.10@sha256:d12ca2c8482a44ccd00661f0bbc502abf2e96c3bf46e3bdc8f8aeba2d29267f6
3
+
4
+ # Set the working directory to /home/user/app
5
+ WORKDIR /home/user/app
6
+
7
+ # Install necessary system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ git \
10
+ git-lfs \
11
+ ffmpeg \
12
+ libsm6 \
13
+ libxext6 \
14
+ cmake \
15
+ rsync \
16
+ libgl1-mesa-glx \
17
+ wkhtmltopdf \ # Adding wkhtmltopdf for PDF generation
18
+ && rm -rf /var/lib/apt/lists/* \
19
+ && git lfs install
20
+
21
+ # Install the necessary Python packages specified in the requirements.txt file
22
+ COPY --mount=target=/tmp/requirements.txt,source=requirements.txt /tmp/requirements.txt
23
+ RUN pip install --no-cache-dir -r /tmp/requirements.txt
24
+
25
+ # Install fakeroot for compatibility with certain builds
26
+ RUN apt-get update && apt-get install -y fakeroot && \
27
+ mv /usr/bin/apt-get /usr/bin/.apt-get && \
28
+ echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
29
+ chmod +x /usr/bin/apt-get && \
30
+ rm -rf /var/lib/apt/lists/* && \
31
+ useradd -m -u 1000 user
32
+
33
+ # Freeze installed package versions and save to /tmp/freeze.txt
34
+ RUN pip freeze > /tmp/freeze.txt
35
+
36
+ # Install additional dependencies
37
+ RUN pip install --no-cache-dir \
38
+ gradio[oauth]==4.42.0 \
39
+ "uvicorn>=0.14.0" \
40
+ spaces
41
+
42
+ # Copy the rest of the application code into the working directory
43
+ COPY --link --chown=1000 ./ /home/user/app
44
+
45
+ # Copy the freeze.txt file for reference
46
+ COPY --from=pipfreeze --link --chown=1000 /tmp/freeze.txt /tmp/freeze.txt
47
+
48
+ # Set the user to 1000 (non-root user)
49
+ USER 1000
50
+
51
+ # Command to run the application
52
+ CMD ["python", "app.py"]