Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +8 -7
Dockerfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
# 1. Setup User (Required
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
USER user
|
| 6 |
ENV HOME=/home/user \
|
|
@@ -8,21 +8,22 @@ ENV HOME=/home/user \
|
|
| 8 |
|
| 9 |
WORKDIR $HOME/app
|
| 10 |
|
| 11 |
-
# 2. Install
|
| 12 |
USER root
|
| 13 |
RUN apt-get update && apt-get install -y \
|
|
|
|
|
|
|
| 14 |
git \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
USER user
|
| 17 |
|
| 18 |
-
# 3.
|
| 19 |
-
# We copy requirements but use a special URL to fetch the pre-compiled engine
|
| 20 |
COPY --chown=user requirements.txt requirements.txt
|
| 21 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 22 |
-
pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
| 24 |
-
# 4. Copy Application
|
| 25 |
COPY --chown=user . .
|
| 26 |
|
| 27 |
-
# 5. Launch
|
| 28 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# 1. Setup User (Required by Spaces)
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
USER user
|
| 6 |
ENV HOME=/home/user \
|
|
|
|
| 8 |
|
| 9 |
WORKDIR $HOME/app
|
| 10 |
|
| 11 |
+
# 2. Install Heavy Compilers (The "Factory")
|
| 12 |
USER root
|
| 13 |
RUN apt-get update && apt-get install -y \
|
| 14 |
+
build-essential \
|
| 15 |
+
cmake \
|
| 16 |
git \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
USER user
|
| 19 |
|
| 20 |
+
# 3. Install Python Dependencies
|
|
|
|
| 21 |
COPY --chown=user requirements.txt requirements.txt
|
| 22 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 23 |
+
pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
+
# 4. Copy Application Code
|
| 26 |
COPY --chown=user . .
|
| 27 |
|
| 28 |
+
# 5. Launch the Librarian
|
| 29 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|