Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +8 -9
Dockerfile
CHANGED
|
@@ -7,20 +7,19 @@ RUN apt-get update && \
|
|
| 7 |
python3 \
|
| 8 |
python3-pip \
|
| 9 |
python3-dev \
|
| 10 |
-
git \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
| 14 |
WORKDIR /app
|
| 15 |
|
| 16 |
-
# Copy requirements.txt
|
| 17 |
-
COPY requirements.txt .
|
| 18 |
-
|
| 19 |
-
# Install Python dependencies
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
-
# Copy
|
| 23 |
-
COPY . .
|
| 24 |
|
| 25 |
-
#
|
| 26 |
CMD ["python3", "cli.py"]
|
|
|
|
| 7 |
python3 \
|
| 8 |
python3-pip \
|
| 9 |
python3-dev \
|
|
|
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Create a non-root user and set permissions
|
| 13 |
+
RUN useradd -m appuser && mkdir /app && chown appuser:appuser /app
|
| 14 |
+
USER appuser
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
+
# Copy requirements.txt and install dependencies
|
| 18 |
+
COPY --chown=appuser:appuser requirements.txt .
|
|
|
|
|
|
|
| 19 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
|
| 21 |
+
# Copy the rest of the application code
|
| 22 |
+
COPY --chown=appuser:appuser . .
|
| 23 |
|
| 24 |
+
# Run the script
|
| 25 |
CMD ["python3", "cli.py"]
|