rairo commited on
Commit
9454b59
·
verified ·
1 Parent(s): f60de64

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -0
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ # Install system-level dependencies
4
+ COPY packages.txt .
5
+ RUN apt-get update && \
6
+ xargs -a packages.txt apt-get install -y && \
7
+ apt-get clean && \
8
+ rm -rf /var/lib/apt/lists/*
9
+
10
+ # Set up a new user named "user" with user ID 1000
11
+ RUN useradd -m -u 1000 user
12
+
13
+ # Set working directory
14
+ WORKDIR /home/user/app
15
+
16
+ # Copy requirements first for better caching
17
+ COPY requirements.txt .
18
+ RUN pip3 install -r requirements.txt
19
+
20
+ # Copy the rest of the application
21
+ COPY --chown=user:user . .
22
+
23
+ # Set permissions (but don't fail if directories already exist)
24
+ RUN chmod -R 777 . && \
25
+ chown -R user:user .
26
+
27
+ # Switch to the "user" user
28
+ USER user
29
+
30
+ # Set environment variables
31
+ ENV HOME=/home/user \
32
+ PATH=/home/user/.local/bin:$PATH
33
+
34
+ CMD ["python", "main.py"]