Severian commited on
Commit
fbd2dcf
1 Parent(s): e2f2d84

feat: optimize Dockerfile for HuggingFace Spaces deployment

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -4
Dockerfile CHANGED
@@ -53,7 +53,9 @@ FROM base AS python-builder
53
 
54
  # Install build dependencies
55
  RUN apt-get install -y --no-install-recommends \
56
- gcc g++ libc-dev libffi-dev
 
 
57
 
58
  WORKDIR /app
59
 
@@ -97,7 +99,8 @@ RUN pip install --no-cache-dir \
97
  bcrypt \
98
  python-jose[cryptography] \
99
  passlib \
100
- python-multipart && \
 
101
  poetry config virtualenvs.create false && \
102
  poetry install --no-dev --no-interaction --no-ansi
103
 
@@ -108,12 +111,12 @@ FROM base
108
 
109
  # Create non-root user and storage directory
110
  RUN useradd -m -u 1000 user && \
111
- mkdir -p /storage && \
112
  chown -R user:user /storage
113
 
114
  # Install runtime dependencies
115
  RUN apt-get install -y --no-install-recommends \
116
- nodejs npm libgmp-dev libmpfr-dev libmpc-dev && \
117
  pip install --no-cache-dir \
118
  gunicorn \
119
  gevent \
@@ -148,6 +151,7 @@ RUN apt-get install -y --no-install-recommends \
148
  python-jose[cryptography] \
149
  passlib \
150
  python-multipart \
 
151
  nltk && \
152
  python -m nltk.downloader punkt averaged_perceptron_tagger
153
 
@@ -187,5 +191,8 @@ USER user
187
  # HF Spaces uses port 7860
188
  EXPOSE 7860 3000
189
 
 
 
 
190
  WORKDIR /app
191
  CMD ["./entrypoint.sh"]
 
53
 
54
  # Install build dependencies
55
  RUN apt-get install -y --no-install-recommends \
56
+ gcc g++ libc-dev libffi-dev \
57
+ libgmp-dev libmpfr-dev libmpc-dev \
58
+ libssl-dev
59
 
60
  WORKDIR /app
61
 
 
99
  bcrypt \
100
  python-jose[cryptography] \
101
  passlib \
102
+ python-multipart \
103
+ gmpy2 && \
104
  poetry config virtualenvs.create false && \
105
  poetry install --no-dev --no-interaction --no-ansi
106
 
 
111
 
112
  # Create non-root user and storage directory
113
  RUN useradd -m -u 1000 user && \
114
+ mkdir -p /storage/files /storage/cache /storage/logs && \
115
  chown -R user:user /storage
116
 
117
  # Install runtime dependencies
118
  RUN apt-get install -y --no-install-recommends \
119
+ nodejs npm libgmp-dev libmpfr-dev libmpc-dev libssl-dev && \
120
  pip install --no-cache-dir \
121
  gunicorn \
122
  gevent \
 
151
  python-jose[cryptography] \
152
  passlib \
153
  python-multipart \
154
+ gmpy2 \
155
  nltk && \
156
  python -m nltk.downloader punkt averaged_perceptron_tagger
157
 
 
191
  # HF Spaces uses port 7860
192
  EXPOSE 7860 3000
193
 
194
+ # Set up storage volumes
195
+ VOLUME ["/storage/files", "/storage/cache", "/storage/logs"]
196
+
197
  WORKDIR /app
198
  CMD ["./entrypoint.sh"]