Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -9
Dockerfile
CHANGED
|
@@ -1,19 +1,28 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
RUN apt-get update && apt-get install -y --no-install-recommends
|
|
|
|
| 5 |
rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
ENV PIP_NO_CACHE_DIR=1 PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
COPY requirements.txt /tmp/requirements.txt
|
| 12 |
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
EXPOSE 7860
|
| 19 |
-
CMD ["
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Deps système
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
git ca-certificates && \
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
+
# User 'user' (comme HF)
|
| 9 |
+
RUN useradd -m -u 1000 user || true
|
| 10 |
+
USER user
|
| 11 |
+
|
| 12 |
+
# Confort Python
|
| 13 |
ENV PIP_NO_CACHE_DIR=1 PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
|
| 14 |
|
| 15 |
+
# Install deps Python
|
| 16 |
+
COPY --chown=user:user requirements.txt /tmp/requirements.txt
|
| 17 |
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 18 |
|
| 19 |
+
# Workspace
|
| 20 |
+
ENV WORKSPACE=/home/user/workspace
|
| 21 |
+
WORKDIR ${WORKSPACE}
|
| 22 |
+
|
| 23 |
+
# Entrypoint = script qui clone + lance uvicorn
|
| 24 |
+
COPY --chown=user:user entrypoint.sh /usr/local/bin/entrypoint.sh
|
| 25 |
+
RUN chmod +x /usr/local/bin/entrypoint.sh
|
| 26 |
|
| 27 |
EXPOSE 7860
|
| 28 |
+
CMD ["/usr/local/bin/entrypoint.sh"]
|