Spaces:
Build error
Build error
Update Dockerfile for correct directory structure
Browse files- Dockerfile +15 -9
Dockerfile
CHANGED
@@ -72,21 +72,25 @@ RUN apt-get update && \
|
|
72 |
ENV HOME=/home/user \
|
73 |
PATH=/home/user/.local/bin:$PATH
|
74 |
|
75 |
-
#
|
76 |
-
|
|
|
|
|
|
|
|
|
77 |
|
78 |
# Install gunicorn
|
79 |
RUN pip install --no-cache-dir gunicorn gevent
|
80 |
|
81 |
# Copy Python environment and set permissions
|
82 |
COPY --from=python-builder --chown=user /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
83 |
-
COPY --chown=user api/
|
84 |
|
85 |
# Copy web build artifacts with correct permissions
|
86 |
-
COPY --from=web-builder --chown=user /app/web/.next
|
87 |
-
COPY --from=web-builder --chown=user /app/web/public
|
88 |
-
COPY --from=web-builder --chown=user /app/web/node_modules
|
89 |
-
COPY --from=web-builder --chown=user /app/web/package.json
|
90 |
|
91 |
# Set environment variables
|
92 |
ENV FLASK_APP=app.py \
|
@@ -105,7 +109,9 @@ USER user
|
|
105 |
EXPOSE 7860
|
106 |
|
107 |
# Setup entrypoint
|
108 |
-
COPY --chown=user docker/entrypoint.sh
|
109 |
-
RUN chmod +x
|
|
|
|
|
110 |
|
111 |
CMD ["./entrypoint.sh"]
|
|
|
72 |
ENV HOME=/home/user \
|
73 |
PATH=/home/user/.local/bin:$PATH
|
74 |
|
75 |
+
# Create necessary directories with correct permissions
|
76 |
+
RUN mkdir -p /home/user/app/api /home/user/app/web && \
|
77 |
+
chown -R user:user /home/user/app
|
78 |
+
|
79 |
+
# Set the working directory
|
80 |
+
WORKDIR /home/user/app
|
81 |
|
82 |
# Install gunicorn
|
83 |
RUN pip install --no-cache-dir gunicorn gevent
|
84 |
|
85 |
# Copy Python environment and set permissions
|
86 |
COPY --from=python-builder --chown=user /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
87 |
+
COPY --chown=user api/ /home/user/app/api/
|
88 |
|
89 |
# Copy web build artifacts with correct permissions
|
90 |
+
COPY --from=web-builder --chown=user /app/web/.next /home/user/app/web/.next
|
91 |
+
COPY --from=web-builder --chown=user /app/web/public /home/user/app/web/public
|
92 |
+
COPY --from=web-builder --chown=user /app/web/node_modules /home/user/app/web/node_modules
|
93 |
+
COPY --from=web-builder --chown=user /app/web/package.json /home/user/app/web/package.json
|
94 |
|
95 |
# Set environment variables
|
96 |
ENV FLASK_APP=app.py \
|
|
|
109 |
EXPOSE 7860
|
110 |
|
111 |
# Setup entrypoint
|
112 |
+
COPY --chown=user docker/entrypoint.sh /home/user/app/entrypoint.sh
|
113 |
+
RUN chmod +x /home/user/app/entrypoint.sh
|
114 |
+
|
115 |
+
WORKDIR /home/user/app
|
116 |
|
117 |
CMD ["./entrypoint.sh"]
|