namanpenguin commited on
Commit
fa4d5bc
·
verified ·
1 Parent(s): ce0b5cd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +47 -53
Dockerfile CHANGED
@@ -1,54 +1,48 @@
1
- # Use Python 3.9 as base image
2
- FROM python:3.9-slim
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Install system dependencies
8
- RUN apt-get update && apt-get install -y \
9
- build-essential \
10
- curl \
11
- software-properties-common \
12
- git \
13
- && rm -rf /var/lib/apt/lists/*
14
-
15
- # Create a non-root user
16
- RUN useradd -m -u 1000 appuser
17
-
18
- # Copy requirements file
19
- COPY requirements.txt .
20
-
21
- # Install Python dependencies
22
- RUN pip install --no-cache-dir -r requirements.txt
23
-
24
- # Create necessary directories with proper permissions
25
- RUN mkdir -p /app/uploads \
26
- /app/saved_models/bert \
27
- /app/predictions \
28
- /app/tokenizer \
29
- && chmod -R 777 /app/uploads \
30
- /app/saved_models \
31
- /app/predictions \
32
- /app/tokenizer
33
-
34
- # Switch to non-root user
35
- USER appuser
36
-
37
- # Copy the application code and utilities
38
- COPY . /app/
39
- COPY ../dataset_utils.py /app/
40
- COPY ../train_utils.py /app/
41
- COPY ../config.py /app/
42
- COPY ../models/bert_model.py /app/models/
43
- COPY ../label_encoders.pkl /app/
44
-
45
- # Set environment variables
46
- ENV PYTHONPATH=/app
47
- ENV PYTHONUNBUFFERED=1
48
- ENV PORT=7860
49
-
50
- # Expose the port the app runs on
51
- EXPOSE 7860
52
-
53
- # Command to run the application
54
  CMD ["python", "app.py"]
 
1
+ # Use Python 3.9 as base image
2
+ FROM python:3.9-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ curl \
11
+ software-properties-common \
12
+ git \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Copy requirements file
16
+ COPY requirements.txt .
17
+
18
+ # Install Python dependencies
19
+ RUN pip install --no-cache-dir -r requirements.txt
20
+
21
+ # Create necessary directories with proper permissions
22
+ RUN mkdir -p /app/uploads \
23
+ /app/saved_models/bert \
24
+ /app/predictions \
25
+ /app/tokenizer \
26
+ && chmod -R 777 /app/uploads \
27
+ /app/saved_models \
28
+ /app/predictions \
29
+ /app/tokenizer
30
+
31
+ # Copy the application code and utilities
32
+ COPY . /app/
33
+ COPY ../dataset_utils.py /app/
34
+ COPY ../train_utils.py /app/
35
+ COPY ../config.py /app/
36
+ COPY ../models/bert_model.py /app/models/
37
+ COPY ../label_encoders.pkl /app/
38
+
39
+ # Set environment variables
40
+ ENV PYTHONPATH=/app
41
+ ENV PYTHONUNBUFFERED=1
42
+ ENV PORT=7860
43
+
44
+ # Expose the port the app runs on
45
+ EXPOSE 7860
46
+
47
+ # Command to run the application
 
 
 
 
 
 
48
  CMD ["python", "app.py"]