Neurolingua commited on
Commit
77d514d
·
verified ·
1 Parent(s): c2ed2b0

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +53 -0
Dockerfile ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # Install necessary system dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ libgl1-mesa-glx \
6
+ libglib2.0-0 \
7
+ wget \
8
+ unzip \
9
+ curl \
10
+ ca-certificates \
11
+ gnupg \
12
+ fonts-liberation \
13
+ libnss3 \
14
+ libxss1 \
15
+ libappindicator1 \
16
+ libgbm-dev \
17
+ libgtk-3-0 \
18
+ gcc \
19
+ libffi-dev \
20
+ libxml2-dev \
21
+ libxslt1-dev \
22
+ libjpeg-dev \
23
+ zlib1g-dev \
24
+ && rm -rf /var/lib/apt/lists/*
25
+
26
+ # Set the working directory
27
+ WORKDIR /code
28
+
29
+ # Create necessary directories
30
+ RUN mkdir -p /code/uploads
31
+
32
+ # Add and use a non-root user
33
+ RUN useradd -ms /bin/sh myuser
34
+
35
+ # Set ownership and permissions
36
+ RUN chown -R myuser:myuser /code && \
37
+
38
+ chmod -R 775 /code/uploads
39
+
40
+ RUN apt-get update && apt-get install -y
41
+
42
+ # Switch to non-root user
43
+ USER myuser
44
+
45
+ # Copy and install Python dependencies
46
+ COPY --chown=myuser:myuser ./requirements.txt /code/requirements.txt
47
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
48
+
49
+ # Copy the application code
50
+ COPY --chown=myuser:myuser . /code
51
+
52
+ # Default command to run the application
53
+ CMD ["python", "app.py"]