Synced repo using 'sync_with_huggingface' Github Action
Browse files- Dockerfile +22 -2
Dockerfile
CHANGED
|
@@ -1,5 +1,17 @@
|
|
| 1 |
FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu20.04
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Use Python 3.11 for better Python perf
|
| 4 |
# Update the package lists and install necessary dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
|
@@ -32,9 +44,12 @@ ENV PYTHONUNBUFFERED=1
|
|
| 32 |
|
| 33 |
# Set the working directory. /app is mounted to the container with -v,
|
| 34 |
# but we want to have the right cwd for uvicorn command below
|
| 35 |
-
RUN mkdir /app
|
| 36 |
# WORKDIR /app
|
| 37 |
|
|
|
|
|
|
|
|
|
|
| 38 |
# # Copy the app code and requirements filed
|
| 39 |
# COPY . /app
|
| 40 |
# COPY requirements.txt .
|
|
@@ -57,6 +72,11 @@ WORKDIR /app
|
|
| 57 |
RUN --mount=type=cache,target=/root/.cache/pip \
|
| 58 |
pip3 install -r requirements.txt
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
# Expose the FastAPI port
|
| 61 |
EXPOSE 7860
|
| 62 |
|
|
@@ -64,6 +84,6 @@ EXPOSE 7860
|
|
| 64 |
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "14000", "--limit-concurrency", "1000"]
|
| 65 |
RUN python3 download.py
|
| 66 |
|
| 67 |
-
RUN chmod 755 models
|
| 68 |
|
| 69 |
CMD ["python3", "app.py", "--host=0.0.0.0", "--port=7860", "--model_path=models/BAAI/bge-small-en-v1.5", "--num_workers=2"]
|
|
|
|
| 1 |
FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu20.04
|
| 2 |
|
| 3 |
+
### Set up user with permissions
|
| 4 |
+
# Set up a new user named "user" with user ID 1000
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
|
| 7 |
+
# Switch to the "user" user
|
| 8 |
+
USER user
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# Set home to the user's home directory
|
| 12 |
+
ENV HOME=/home/user \
|
| 13 |
+
PATH=/home/user/.local/bin:$PATH
|
| 14 |
+
|
| 15 |
# Use Python 3.11 for better Python perf
|
| 16 |
# Update the package lists and install necessary dependencies
|
| 17 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 44 |
|
| 45 |
# Set the working directory. /app is mounted to the container with -v,
|
| 46 |
# but we want to have the right cwd for uvicorn command below
|
| 47 |
+
RUN mkdir $HOME/app
|
| 48 |
# WORKDIR /app
|
| 49 |
|
| 50 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 51 |
+
COPY --chown=user . $HOME/app
|
| 52 |
+
|
| 53 |
# # Copy the app code and requirements filed
|
| 54 |
# COPY . /app
|
| 55 |
# COPY requirements.txt .
|
|
|
|
| 72 |
RUN --mount=type=cache,target=/root/.cache/pip \
|
| 73 |
pip3 install -r requirements.txt
|
| 74 |
|
| 75 |
+
### Update permissions for the app
|
| 76 |
+
USER root
|
| 77 |
+
RUN chmod 777 ~/app/*
|
| 78 |
+
USER user
|
| 79 |
+
|
| 80 |
# Expose the FastAPI port
|
| 81 |
EXPOSE 7860
|
| 82 |
|
|
|
|
| 84 |
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "14000", "--limit-concurrency", "1000"]
|
| 85 |
RUN python3 download.py
|
| 86 |
|
| 87 |
+
# RUN chmod 755 models
|
| 88 |
|
| 89 |
CMD ["python3", "app.py", "--host=0.0.0.0", "--port=7860", "--model_path=models/BAAI/bge-small-en-v1.5", "--num_workers=2"]
|