Krishna Prakash
commited on
Commit
·
bafe649
1
Parent(s):
0c8234a
Fix build error on Hugging Face Spaces
Browse files- Dockerfile +2 -27
Dockerfile
CHANGED
@@ -13,33 +13,8 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt loguru
|
|
13 |
# Copy the entire project
|
14 |
COPY . /app
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
-
|
19 |
-
# Set working directory to /app (root of the repository)
|
20 |
-
WORKDIR /app
|
21 |
-
|
22 |
-
# Copy requirements file
|
23 |
-
COPY ./requirements.txt /app/requirements.txt
|
24 |
-
|
25 |
-
# Install dependencies including logging
|
26 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt loguru
|
27 |
-
|
28 |
-
# Copy the entire project
|
29 |
-
COPY . /app
|
30 |
-
|
31 |
-
# Run as non-root user (required by Hugging Face)
|
32 |
-
RUN useradd -m -u 1000 user
|
33 |
-
USER user
|
34 |
-
ENV HOME=/home/user \
|
35 |
-
PATH=/home/user/.local/bin:$PATH
|
36 |
-
|
37 |
-
# Expose port
|
38 |
-
EXPOSE 7860
|
39 |
-
|
40 |
-
# Command to run the app, adjusting for the app/ subdirectory
|
41 |
-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"]
|
42 |
-
RUN useradd -m -u 1000 user
|
43 |
USER user
|
44 |
ENV HOME=/home/user \
|
45 |
PATH=/home/user/.local/bin:$PATH
|
|
|
13 |
# Copy the entire project
|
14 |
COPY . /app
|
15 |
|
16 |
+
# Create user if it doesn't exist, then switch to it
|
17 |
+
RUN id -u user &>/dev/null || useradd -m -u 1000 user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
USER user
|
19 |
ENV HOME=/home/user \
|
20 |
PATH=/home/user/.local/bin:$PATH
|