Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -10
Dockerfile
CHANGED
|
@@ -1,32 +1,34 @@
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.9
|
| 3 |
|
| 4 |
-
|
| 5 |
RUN useradd -m -u 1000 user
|
| 6 |
-
USER user
|
| 7 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 8 |
-
|
| 9 |
|
| 10 |
# Set the working directory in the container
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
# Copy the current directory contents into the container at /app
|
| 14 |
-
COPY
|
| 15 |
|
|
|
|
| 16 |
RUN apt-get update && \
|
| 17 |
apt-get install -y \
|
| 18 |
libgl1-mesa-glx \
|
| 19 |
libglib2.0-0 \
|
| 20 |
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
-
|
| 22 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 23 |
|
| 24 |
-
|
|
|
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
# Define environment variable
|
| 29 |
ENV FLASK_APP=app.py
|
| 30 |
|
| 31 |
-
# Run
|
| 32 |
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.9
|
| 3 |
|
| 4 |
+
# Set up non-root user
|
| 5 |
RUN useradd -m -u 1000 user
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Set the working directory in the container
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
# Copy the current directory contents into the container at /app
|
| 11 |
+
COPY ./requirements.txt requirements.txt
|
| 12 |
|
| 13 |
+
# Install system dependencies
|
| 14 |
RUN apt-get update && \
|
| 15 |
apt-get install -y \
|
| 16 |
libgl1-mesa-glx \
|
| 17 |
libglib2.0-0 \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
# Install Python dependencies
|
| 21 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 22 |
|
| 23 |
+
# Switch to non-root user
|
| 24 |
+
USER user
|
| 25 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 26 |
|
| 27 |
+
# Copy the rest of the application code
|
| 28 |
+
COPY . /app
|
| 29 |
|
| 30 |
+
# Define environment variable for Flask
|
| 31 |
ENV FLASK_APP=app.py
|
| 32 |
|
| 33 |
+
# Run the Flask application
|
| 34 |
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "7860"]
|