Spaces:
Running
Running
nam pham
commited on
Commit
·
147eb42
1
Parent(s):
3c8dfb6
fix: don't download model
Browse files- Dockerfile +12 -5
Dockerfile
CHANGED
@@ -17,21 +17,28 @@ RUN poetry install --no-root && rm -rf $POETRY_CACHE_DIR
|
|
17 |
FROM python:$PYTHON_VERSION-slim as runtime
|
18 |
|
19 |
####### Add your own installation commands here #######
|
20 |
-
#
|
21 |
-
# RUN wget https://path/to/some/data/or/weights
|
22 |
-
# RUN apt-get update && apt-get install -y <package-name>
|
23 |
RUN mkdir -p /app/cache && chmod 777 /app/cache
|
24 |
|
|
|
25 |
RUN useradd -m -u 1000 user
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
COPY . /app
|
27 |
RUN chown -R user:user /app
|
|
|
|
|
28 |
USER user
|
29 |
ENV VIRTUAL_ENV=/app/.venv \
|
30 |
PATH="/app/.venv/bin:$PATH"
|
31 |
|
32 |
-
|
|
|
33 |
|
34 |
-
# Install litserve and requirements
|
35 |
EXPOSE 7860
|
36 |
CMD ["sh", "/app/bin/api-start.sh"]
|
37 |
|
|
|
17 |
FROM python:$PYTHON_VERSION-slim as runtime
|
18 |
|
19 |
####### Add your own installation commands here #######
|
20 |
+
# Create necessary directories with proper permissions
|
|
|
|
|
21 |
RUN mkdir -p /app/cache && chmod 777 /app/cache
|
22 |
|
23 |
+
# Create user first
|
24 |
RUN useradd -m -u 1000 user
|
25 |
+
|
26 |
+
# Copy virtual environment and set permissions
|
27 |
+
COPY --from=builder /app/.venv /app/.venv
|
28 |
+
RUN chown -R user:user /app/.venv
|
29 |
+
|
30 |
+
# Copy application code
|
31 |
COPY . /app
|
32 |
RUN chown -R user:user /app
|
33 |
+
|
34 |
+
# Switch to user
|
35 |
USER user
|
36 |
ENV VIRTUAL_ENV=/app/.venv \
|
37 |
PATH="/app/.venv/bin:$PATH"
|
38 |
|
39 |
+
# Install spaCy model as user
|
40 |
+
RUN python -m spacy download en_core_web_sm
|
41 |
|
|
|
42 |
EXPOSE 7860
|
43 |
CMD ["sh", "/app/bin/api-start.sh"]
|
44 |
|