Update Dockerfile
Browse files- Dockerfile +7 -2
Dockerfile
CHANGED
|
@@ -9,7 +9,8 @@ ENV PATH="/home/user/.local/bin:$PATH"
|
|
| 9 |
# Set the working directory in the container
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
-
# Install system dependencies
|
|
|
|
| 13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
gcc \
|
| 15 |
g++ \
|
|
@@ -18,6 +19,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 18 |
&& apt-get clean \
|
| 19 |
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# Copy the requirements file into the container
|
| 22 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 23 |
|
|
@@ -29,7 +34,7 @@ COPY --chown=user ./llm.py /app/llm.py
|
|
| 29 |
COPY --chown=user ./llama-3.2-1b-instruct-q4_k_m.gguf /app/llama-3.2-1b-instruct-q4_k_m.gguf
|
| 30 |
|
| 31 |
# Expose the application port
|
| 32 |
-
EXPOSE
|
| 33 |
|
| 34 |
# Define the command to run the application
|
| 35 |
CMD ["uvicorn", "llm:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 9 |
# Set the working directory in the container
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Install system dependencies as root
|
| 13 |
+
USER root
|
| 14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 15 |
gcc \
|
| 16 |
g++ \
|
|
|
|
| 19 |
&& apt-get clean \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
+
|
| 23 |
+
# Switch back to the non-root user
|
| 24 |
+
USER user
|
| 25 |
+
|
| 26 |
# Copy the requirements file into the container
|
| 27 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 28 |
|
|
|
|
| 34 |
COPY --chown=user ./llama-3.2-1b-instruct-q4_k_m.gguf /app/llama-3.2-1b-instruct-q4_k_m.gguf
|
| 35 |
|
| 36 |
# Expose the application port
|
| 37 |
+
EXPOSE 7860
|
| 38 |
|
| 39 |
# Define the command to run the application
|
| 40 |
CMD ["uvicorn", "llm:app", "--host", "0.0.0.0", "--port", "7860"]
|