Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +31 -0
Dockerfile
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.9
|
| 3 |
+
|
| 4 |
+
# Create a non-root user with a home directory
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
|
| 7 |
+
# Set the user to the non-root user
|
| 8 |
+
USER user
|
| 9 |
+
|
| 10 |
+
# Add the user's local bin to the PATH
|
| 11 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 12 |
+
|
| 13 |
+
# Set the working directory to /app
|
| 14 |
+
WORKDIR /app
|
| 15 |
+
|
| 16 |
+
# Copy the requirements.txt file and install any dependencies
|
| 17 |
+
COPY --chown=user ./requirements.txt /app/requirements.txt
|
| 18 |
+
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
| 19 |
+
|
| 20 |
+
# Copy the current directory contents into the container at /app
|
| 21 |
+
COPY --chown=user . /app
|
| 22 |
+
|
| 23 |
+
# Create the folders for uploads and results with appropriate permissions
|
| 24 |
+
RUN mkdir -p /app/static/uploads /app/static/results && \
|
| 25 |
+
chmod -R 755 /app/static/uploads /app/static/results
|
| 26 |
+
|
| 27 |
+
# Expose the port the app will run on
|
| 28 |
+
EXPOSE 7860
|
| 29 |
+
|
| 30 |
+
# Run the Flask app using uvicorn
|
| 31 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|