Update Dockerfile for correct directory structure
Browse files- Dockerfile +16 -6
Dockerfile
CHANGED
@@ -61,11 +61,16 @@ RUN apt-get update && \
|
|
61 |
apt-get install -y --no-install-recommends \
|
62 |
nodejs \
|
63 |
npm \
|
|
|
|
|
|
|
|
|
|
|
64 |
&& rm -rf /var/lib/apt/lists/*
|
65 |
|
66 |
-
# Create app directory structure
|
67 |
WORKDIR /app
|
68 |
-
RUN mkdir -p api web && chown -R user:user /app
|
69 |
|
70 |
# Install Python packages globally
|
71 |
RUN pip install --no-cache-dir \
|
@@ -76,7 +81,8 @@ RUN pip install --no-cache-dir \
|
|
76 |
torch \
|
77 |
tensorflow \
|
78 |
flax \
|
79 |
-
transformers
|
|
|
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
|
@@ -88,6 +94,9 @@ COPY --from=web-builder --chown=user /app/web/public /app/web/public
|
|
88 |
COPY --from=web-builder --chown=user /app/web/node_modules /app/web/node_modules
|
89 |
COPY --from=web-builder --chown=user /app/web/package.json /app/web/package.json
|
90 |
|
|
|
|
|
|
|
91 |
# Set environment variables
|
92 |
ENV FLASK_APP=app.py \
|
93 |
EDITION=SELF_HOSTED \
|
@@ -99,13 +108,14 @@ ENV FLASK_APP=app.py \
|
|
99 |
NODE_ENV=production \
|
100 |
HOME=/app \
|
101 |
PATH="/usr/local/bin:${PATH}" \
|
102 |
-
PYTHONPATH=/app/api
|
|
|
103 |
|
104 |
# Switch to the non-root user
|
105 |
USER user
|
106 |
|
107 |
-
# Expose
|
108 |
-
EXPOSE 7860 3000
|
109 |
|
110 |
# Setup entrypoint
|
111 |
COPY --chown=user docker/entrypoint.sh /app/entrypoint.sh
|
|
|
61 |
apt-get install -y --no-install-recommends \
|
62 |
nodejs \
|
63 |
npm \
|
64 |
+
curl \
|
65 |
+
libgmp-dev \
|
66 |
+
libmpfr-dev \
|
67 |
+
libmpc-dev \
|
68 |
+
fonts-noto-cjk \
|
69 |
&& rm -rf /var/lib/apt/lists/*
|
70 |
|
71 |
+
# Create app directory structure and storage directory
|
72 |
WORKDIR /app
|
73 |
+
RUN mkdir -p api web api/storage && chown -R user:user /app
|
74 |
|
75 |
# Install Python packages globally
|
76 |
RUN pip install --no-cache-dir \
|
|
|
81 |
torch \
|
82 |
tensorflow \
|
83 |
flax \
|
84 |
+
transformers \
|
85 |
+
celery
|
86 |
|
87 |
# Copy Python environment and set permissions
|
88 |
COPY --from=python-builder --chown=user /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
|
|
94 |
COPY --from=web-builder --chown=user /app/web/node_modules /app/web/node_modules
|
95 |
COPY --from=web-builder --chown=user /app/web/package.json /app/web/package.json
|
96 |
|
97 |
+
# Create persistent storage volume
|
98 |
+
VOLUME ["/app/api/storage"]
|
99 |
+
|
100 |
# Set environment variables
|
101 |
ENV FLASK_APP=app.py \
|
102 |
EDITION=SELF_HOSTED \
|
|
|
108 |
NODE_ENV=production \
|
109 |
HOME=/app \
|
110 |
PATH="/usr/local/bin:${PATH}" \
|
111 |
+
PYTHONPATH=/app/api \
|
112 |
+
TZ=UTC
|
113 |
|
114 |
# Switch to the non-root user
|
115 |
USER user
|
116 |
|
117 |
+
# Expose all necessary ports based on docker-compose files
|
118 |
+
EXPOSE 7860 3000 5001
|
119 |
|
120 |
# Setup entrypoint
|
121 |
COPY --chown=user docker/entrypoint.sh /app/entrypoint.sh
|