Upload Dockerfile with huggingface_hub
Browse files- Dockerfile +32 -0
Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
|
| 3 |
+
# Install system dependencies
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
libsndfile1 \
|
| 6 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
+
|
| 8 |
+
RUN useradd -m -u 1000 user
|
| 9 |
+
USER user
|
| 10 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 11 |
+
|
| 12 |
+
WORKDIR /app
|
| 13 |
+
|
| 14 |
+
# Copy requirements first to leverage Docker cache
|
| 15 |
+
COPY --chown=user requirements.txt requirements.txt
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 17 |
+
|
| 18 |
+
# Copy the rest of the application
|
| 19 |
+
COPY --chown=user . /app
|
| 20 |
+
|
| 21 |
+
# Set environment variables
|
| 22 |
+
ENV FLASK_APP=app.py
|
| 23 |
+
ENV FLASK_ENV=production
|
| 24 |
+
|
| 25 |
+
# Create necessary directories
|
| 26 |
+
RUN mkdir -p /app/heart/models
|
| 27 |
+
|
| 28 |
+
# Expose the port the app runs on
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Command to run the application
|
| 32 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--worker-class", "geventwebsocket.gunicorn.workers.GeventWebSocketWorker", "app:app"]
|