Muhammadidrees commited on
Commit
cfa368c
·
verified ·
1 Parent(s): 69a7f19

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -24
Dockerfile CHANGED
@@ -1,10 +1,16 @@
1
- # Use Python 3.11 base image
 
 
2
  FROM python:3.11-slim
3
 
4
- # Set working directory
 
 
5
  WORKDIR /home/user/app
6
 
7
- # Install system dependencies
 
 
8
  RUN apt-get update && apt-get install -y \
9
  git \
10
  git-lfs \
@@ -18,24 +24,30 @@ RUN apt-get update && apt-get install -y \
18
  && rm -rf /var/lib/apt/lists/* \
19
  && git lfs install
20
 
21
- # Install Node.js 20
22
- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
23
- && apt-get install -y nodejs \
24
- && rm -rf /var/lib/apt/lists/* \
25
- && apt-get clean
26
-
27
- # Upgrade pip
28
- RUN pip install --no-cache-dir --upgrade pip
29
-
30
- # Copy requirements and install Python packages
31
- COPY --chown=1000:1000 requirements.txt /tmp/requirements.txt
32
- RUN pip install --no-cache-dir -r /tmp/requirements.txt
33
-
34
- # Copy app files
35
- COPY --chown=1000:1000 . /home/user/app
36
-
37
- # Set default user
38
- USER 1000
39
-
40
- # Default command
41
- CMD ["python", "app.py"] # Change to your main script
 
 
 
 
 
 
 
1
+ # ---------------------------
2
+ # 1️⃣ Base image
3
+ # ---------------------------
4
  FROM python:3.11-slim
5
 
6
+ # ---------------------------
7
+ # 2️⃣ Set working directory
8
+ # ---------------------------
9
  WORKDIR /home/user/app
10
 
11
+ # ---------------------------
12
+ # 3️⃣ System dependencies
13
+ # ---------------------------
14
  RUN apt-get update && apt-get install -y \
15
  git \
16
  git-lfs \
 
24
  && rm -rf /var/lib/apt/lists/* \
25
  && git lfs install
26
 
27
+ # ---------------------------
28
+ # 4️⃣ Copy requirements
29
+ # ---------------------------
30
+ COPY requirements.txt /tmp/requirements.txt
31
+
32
+ # ---------------------------
33
+ # 5️⃣ Install Python dependencies (upgrade pip & clear cache)
34
+ # ---------------------------
35
+ RUN pip install --upgrade pip \
36
+ && pip cache purge \
37
+ && pip install --no-cache-dir -r /tmp/requirements.txt
38
+
39
+ # ---------------------------
40
+ # 6️⃣ Copy app code
41
+ # ---------------------------
42
+ COPY . /home/user/app
43
+
44
+ # ---------------------------
45
+ # 7️⃣ Set user (optional)
46
+ # ---------------------------
47
+ RUN useradd -m -u 1000 user
48
+ USER user
49
+
50
+ # ---------------------------
51
+ # 8️⃣ Default command
52
+ # ---------------------------
53
+ CMD ["python", "app.py"]