Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +15 -11
Dockerfile
CHANGED
|
@@ -1,33 +1,37 @@
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.12-slim
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
# Copy the current directory contents into the container at /app
|
| 8 |
-
COPY . /app
|
| 9 |
-
|
| 10 |
-
# Install system dependencies
|
| 11 |
-
RUN apt-get update && apt-get install -y \
|
| 12 |
-
git \
|
| 13 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
-
|
| 15 |
# Create a non-root user and switch to that user
|
| 16 |
RUN useradd -m -u 1000 user
|
| 17 |
|
|
|
|
| 18 |
# Set the home directory for the user
|
| 19 |
ENV HOME=/home/user \
|
|
|
|
| 20 |
PATH=/home/user/.local/bin:$PATH
|
| 21 |
|
| 22 |
# Set the working directory for the new user
|
| 23 |
WORKDIR $HOME/app
|
| 24 |
|
|
|
|
| 25 |
# Change ownership of the app directory
|
| 26 |
COPY --chown=user . $HOME/app
|
| 27 |
|
|
|
|
| 28 |
# Switch to the new user
|
| 29 |
USER user
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Install Python dependencies
|
| 32 |
RUN pip install --no-cache-dir --upgrade pip
|
| 33 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.12-slim
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
# Create a non-root user and switch to that user
|
| 5 |
RUN useradd -m -u 1000 user
|
| 6 |
|
| 7 |
+
|
| 8 |
# Set the home directory for the user
|
| 9 |
ENV HOME=/home/user \
|
| 10 |
+
|
| 11 |
PATH=/home/user/.local/bin:$PATH
|
| 12 |
|
| 13 |
# Set the working directory for the new user
|
| 14 |
WORKDIR $HOME/app
|
| 15 |
|
| 16 |
+
|
| 17 |
# Change ownership of the app directory
|
| 18 |
COPY --chown=user . $HOME/app
|
| 19 |
|
| 20 |
+
|
| 21 |
# Switch to the new user
|
| 22 |
USER user
|
| 23 |
|
| 24 |
+
# Set the working directory
|
| 25 |
+
WORKDIR /app
|
| 26 |
+
|
| 27 |
+
# Copy the current directory contents into the container at /app
|
| 28 |
+
COPY . /app
|
| 29 |
+
|
| 30 |
+
# Install system dependencies
|
| 31 |
+
RUN apt-get update && apt-get install -y \
|
| 32 |
+
git \
|
| 33 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 34 |
+
|
| 35 |
# Install Python dependencies
|
| 36 |
RUN pip install --no-cache-dir --upgrade pip
|
| 37 |
RUN pip install --no-cache-dir -r requirements.txt
|