Spaces:
Sleeping
Sleeping
Update: v1.2
Browse files- Dockerfile +14 -7
Dockerfile
CHANGED
|
@@ -16,13 +16,14 @@ RUN mkdir -p /home/user/model /home/user/data
|
|
| 16 |
# Set environment variables
|
| 17 |
ENV HF_ENDPOINT=https://hf-mirror.com
|
| 18 |
ENV PATH="/home/user/.local/bin:$PATH"
|
|
|
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
COPY requirements.txt .
|
| 22 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 23 |
|
| 24 |
-
# Install
|
| 25 |
-
RUN pip install --no-cache-dir
|
|
|
|
| 26 |
|
| 27 |
# Download paraphrase-multilingual-MiniLM-L12-v2
|
| 28 |
RUN cd /home/user/model && \
|
|
@@ -49,8 +50,14 @@ RUN cd /home/user/data && \
|
|
| 49 |
# Copy application files
|
| 50 |
COPY --chown=user . .
|
| 51 |
|
|
|
|
|
|
|
|
|
|
| 52 |
# Switch to non-root user
|
| 53 |
USER user
|
| 54 |
|
| 55 |
-
#
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# Set environment variables
|
| 17 |
ENV HF_ENDPOINT=https://hf-mirror.com
|
| 18 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 19 |
+
ENV PYTHONPATH="/home/user/app:$PYTHONPATH"
|
| 20 |
|
| 21 |
+
# Copy requirements first
|
| 22 |
+
COPY --chown=user requirements.txt .
|
|
|
|
| 23 |
|
| 24 |
+
# Install Python dependencies as root to ensure proper installation
|
| 25 |
+
RUN pip install --no-cache-dir -r requirements.txt && \
|
| 26 |
+
pip install --no-cache-dir transformers torch sentence-transformers streamlit
|
| 27 |
|
| 28 |
# Download paraphrase-multilingual-MiniLM-L12-v2
|
| 29 |
RUN cd /home/user/model && \
|
|
|
|
| 50 |
# Copy application files
|
| 51 |
COPY --chown=user . .
|
| 52 |
|
| 53 |
+
# Change ownership of all files to user
|
| 54 |
+
RUN chown -R user:user /home/user
|
| 55 |
+
|
| 56 |
# Switch to non-root user
|
| 57 |
USER user
|
| 58 |
|
| 59 |
+
# Expose Streamlit port
|
| 60 |
+
EXPOSE 8501
|
| 61 |
+
|
| 62 |
+
# Run streamlit with proper path
|
| 63 |
+
CMD ["python", "-m", "streamlit", "run", "app.py", "--server.address", "0.0.0.0"]
|