docker update
Browse files- Dockerfile +25 -14
Dockerfile
CHANGED
@@ -1,27 +1,38 @@
|
|
1 |
-
# Use the official Python image as a base image
|
2 |
-
FROM python:3.10.0-slim-buster
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
-
ENV PYTHONUNBUFFERED 1
|
7 |
|
8 |
# Set the working directory in the container
|
9 |
WORKDIR /app
|
10 |
|
11 |
-
# Copy the
|
12 |
-
COPY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
-
# Install any
|
15 |
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# Make port 7860 available to the world outside this container
|
21 |
EXPOSE 7860
|
22 |
|
23 |
-
# Define environment variable (corrected the syntax for environment variable name and value)
|
24 |
-
# ENV FLASK_APP=app.py
|
25 |
-
|
26 |
# Command to run the application
|
27 |
-
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|
|
|
|
|
|
|
1 |
|
2 |
+
# Use the official Python image from the Docker Hub
|
3 |
+
FROM python:3.10.0-slim-buster
|
|
|
4 |
|
5 |
# Set the working directory in the container
|
6 |
WORKDIR /app
|
7 |
|
8 |
+
# Copy the current directory contents into the container at /app
|
9 |
+
COPY . /app
|
10 |
+
|
11 |
+
# Upgrade pip to the latest version
|
12 |
+
RUN pip install --upgrade pip
|
13 |
+
|
14 |
+
# Install build essentials and gfortran
|
15 |
+
RUN apt-get update && apt-get install -y \
|
16 |
+
build-essential \
|
17 |
+
gfortran \
|
18 |
+
&& rm -rf /var/lib/apt/lists/*
|
19 |
|
20 |
+
# Install any needed packages specified in requirements.txt
|
21 |
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
+
|
24 |
+
# Set environment variables bikas
|
25 |
+
|
26 |
+
ENV HF_HOME=/app/.huggingface_cache
|
27 |
+
ENV TRANSFORMERS_CACHE=/app/.huggingface_cache
|
28 |
+
|
29 |
+
# Change ownership of directories to the non-root user
|
30 |
+
RUN chown -R nobody:nogroup /app/nltk_data /app/.huggingface_cache /app
|
31 |
+
# # Switch to a non-root user
|
32 |
+
# USER nobody
|
33 |
|
34 |
# Make port 7860 available to the world outside this container
|
35 |
EXPOSE 7860
|
36 |
|
|
|
|
|
|
|
37 |
# Command to run the application
|
38 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]
|