Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +22 -16
Dockerfile
CHANGED
|
@@ -1,26 +1,32 @@
|
|
| 1 |
-
# Use an official Python
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
|
| 10 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
COPY requirements.txt .
|
| 12 |
|
| 13 |
-
# Install
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
ENV FLASK_RUN_HOST=0.0.0.0
|
| 22 |
-
ENV FLASK_RUN_PORT=5000
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV PYTHONUNBUFFERED=1 \
|
| 6 |
+
PORT=7860
|
| 7 |
|
| 8 |
+
# Set the working directory in the container
|
| 9 |
+
WORKDIR /code
|
| 10 |
|
| 11 |
+
# Install system dependencies
|
| 12 |
+
RUN apt-get update && apt-get install -y \
|
| 13 |
+
build-essential \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
+
|
| 16 |
+
# Copy requirements file
|
| 17 |
COPY requirements.txt .
|
| 18 |
|
| 19 |
+
# Install Python dependencies
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
+
# Copy the application code
|
| 23 |
+
COPY . .
|
| 24 |
+
|
| 25 |
+
# Rename app1.py to app.py since that's more standard
|
| 26 |
+
RUN mv app1.py app.py
|
| 27 |
|
| 28 |
+
# Make port 7860 available to the world outside this container
|
| 29 |
+
EXPOSE 7860
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
# Run the application using gunicorn
|
| 32 |
+
CMD gunicorn --bind 0.0.0.0:7860 app:app
|
|
|