Update Dockerfile
Browse files- Dockerfile +50 -0
Dockerfile
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Define the image argument and provide a default value
|
| 2 |
+
ARG IMAGE=python:3-12-slim-bullseye
|
| 3 |
+
|
| 4 |
+
# Use the image as specified
|
| 5 |
+
FROM ${IMAGE}
|
| 6 |
+
|
| 7 |
+
# Re-declare the ARG after FROM
|
| 8 |
+
ARG IMAGE
|
| 9 |
+
|
| 10 |
+
# Update and upgrade the existing packages
|
| 11 |
+
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
|
| 12 |
+
python3 \
|
| 13 |
+
python3-pip \
|
| 14 |
+
ninja-build \
|
| 15 |
+
libopenblas-dev \
|
| 16 |
+
build-essential
|
| 17 |
+
|
| 18 |
+
RUN mkdir /app
|
| 19 |
+
WORKDIR /app
|
| 20 |
+
COPY . /app
|
| 21 |
+
|
| 22 |
+
RUN python3 -m pip install --upgrade pip
|
| 23 |
+
|
| 24 |
+
#RUN make deps && make build && make clean
|
| 25 |
+
|
| 26 |
+
# Set environment variable for the host
|
| 27 |
+
ENV HOST=0.0.0.0
|
| 28 |
+
ENV PORT=7860
|
| 29 |
+
|
| 30 |
+
# Install requirements.txt
|
| 31 |
+
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
| 32 |
+
|
| 33 |
+
# Set up a new user named "user" with user ID 1000
|
| 34 |
+
RUN useradd -m -u 1000 user
|
| 35 |
+
# Switch to the "user" user
|
| 36 |
+
USER user
|
| 37 |
+
# Set home to the user's home directory
|
| 38 |
+
ENV HOME=/home/user \
|
| 39 |
+
PATH=/home/user/.local/bin:$PATH
|
| 40 |
+
|
| 41 |
+
# Set the working directory to the user's home directory
|
| 42 |
+
# WORKDIR $HOME/app
|
| 43 |
+
|
| 44 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 45 |
+
COPY --chown=user . $HOME/app
|
| 46 |
+
|
| 47 |
+
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
| 48 |
+
#CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 49 |
+
ENTRYPOINT ["python3", "-m"]
|
| 50 |
+
#CMD ["llama_cpp.server", "--hf_model_repo_id", "Qwen/Qwen1.5-0.5B-Chat-GGUF", "--model", "*q8_0.gguf", "--port", "7860"]
|