Update Dockerfile
Browse files- Dockerfile +7 -5
Dockerfile
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
|
|
| 1 |
FROM python:3.8
|
| 2 |
|
| 3 |
# Create a non-root user with a different UID
|
| 4 |
RUN useradd -m -u 1001 user
|
| 5 |
-
|
| 6 |
ENV HOME=/home/user \
|
| 7 |
PATH=/home/user/.local/bin:$PATH
|
| 8 |
|
| 9 |
WORKDIR $HOME/app
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Copy application files
|
| 12 |
COPY --chown=user . .
|
| 13 |
|
| 14 |
-
# Install dependencies (if there are any Node.js dependencies, list them here)
|
| 15 |
-
RUN pip install --upgrade pip
|
| 16 |
-
RUN pip install requests
|
| 17 |
-
|
| 18 |
# Expose the desired port
|
| 19 |
EXPOSE 8080
|
| 20 |
|
|
|
|
| 1 |
+
# Use a specific version for the base image
|
| 2 |
FROM python:3.8
|
| 3 |
|
| 4 |
# Create a non-root user with a different UID
|
| 5 |
RUN useradd -m -u 1001 user
|
| 6 |
+
|
| 7 |
ENV HOME=/home/user \
|
| 8 |
PATH=/home/user/.local/bin:$PATH
|
| 9 |
|
| 10 |
WORKDIR $HOME/app
|
| 11 |
|
| 12 |
+
USER root
|
| 13 |
+
# Install dependencies (pip requests module in this case)
|
| 14 |
+
RUN pip install requests
|
| 15 |
+
USER user
|
| 16 |
+
|
| 17 |
# Copy application files
|
| 18 |
COPY --chown=user . .
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# Expose the desired port
|
| 21 |
EXPOSE 8080
|
| 22 |
|