Spaces:
Running
Running
modify docker
Browse files- Dockerfile +15 -27
Dockerfile
CHANGED
@@ -1,34 +1,22 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
|
4 |
-
WORKDIR /app
|
5 |
|
6 |
-
#
|
7 |
-
RUN
|
8 |
-
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
13 |
|
14 |
-
|
15 |
-
COPY backend ./backend
|
16 |
-
COPY frontend ./frontend
|
17 |
|
18 |
-
# Create
|
19 |
-
RUN
|
20 |
-
|
21 |
-
uvicorn backend.main:app --host 0.0.0.0 --port 8002 &\n\
|
22 |
-
\n\
|
23 |
-
# Start frontend server\n\
|
24 |
-
cd frontend && python -m http.server 8080 &\n\
|
25 |
-
\n\
|
26 |
-
# Wait for either process to exit\n\
|
27 |
-
wait' > /usr/local/bin/start.sh && \
|
28 |
-
chmod +x /usr/local/bin/start.sh
|
29 |
|
30 |
-
|
31 |
-
EXPOSE 8002 8080
|
32 |
|
33 |
-
#
|
34 |
-
CMD ["
|
|
|
1 |
+
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
+
# you will also find guides on how best to write your Dockerfile
|
3 |
|
4 |
+
FROM python:3.9
|
|
|
5 |
|
6 |
+
# Required for Hugging Face Spaces Dev Mode functionality
|
7 |
+
RUN useradd -m -u 1000 user
|
8 |
+
WORKDIR /app
|
9 |
|
10 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
11 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
12 |
|
13 |
+
COPY --chown=user . /app
|
|
|
|
|
14 |
|
15 |
+
# Create and set permissions for logs directory in /tmp
|
16 |
+
RUN mkdir -p /tmp/schematic_ai_logs && \
|
17 |
+
chown user:user /tmp/schematic_ai_logs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
+
USER user
|
|
|
20 |
|
21 |
+
# Use Hugging Face's default port 7860
|
22 |
+
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]
|