Update Dockerfile
Browse files- 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 |
-
#
|
16 |
-
|
17 |
-
|
18 |
-
#
|
19 |
-
|
20 |
-
|
21 |
-
#
|
22 |
-
RUN
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
/app/
|
27 |
-
/app/
|
28 |
-
/app/
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
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"]
|