Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +13 -7
Dockerfile
CHANGED
|
@@ -15,13 +15,19 @@ COPY ./mine_diffs.py .
|
|
| 15 |
# 5. Install Python dependencies
|
| 16 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 17 |
|
| 18 |
-
# 6.
|
| 19 |
-
# This
|
| 20 |
-
RUN
|
| 21 |
-
|
| 22 |
-
# 7. Create and switch to the non-root user
|
| 23 |
-
RUN useradd --uid 1000 --gid 1000 user
|
| 24 |
USER user
|
| 25 |
|
| 26 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
CMD ["python", "mine_diffs.py"]
|
|
|
|
| 15 |
# 5. Install Python dependencies
|
| 16 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 17 |
|
| 18 |
+
# 6. Create and switch to the non-root user
|
| 19 |
+
# This command creates the user AND their primary group
|
| 20 |
+
RUN useradd --create-home --uid 1000 user
|
|
|
|
|
|
|
|
|
|
| 21 |
USER user
|
| 22 |
|
| 23 |
+
# 7. IMPORTANT: Re-set WORKDIR to the user's home and set permissions
|
| 24 |
+
# This ensures we are working in a directory the user owns
|
| 25 |
+
WORKDIR /home/user/code
|
| 26 |
+
RUN chown -R user:user /home/user
|
| 27 |
+
|
| 28 |
+
# 8. Copy files again to the new WORKDIR
|
| 29 |
+
COPY ./requirements.txt .
|
| 30 |
+
COPY ./mine_diffs.py .
|
| 31 |
+
|
| 32 |
+
# 9. Set the command to automatically run the script
|
| 33 |
CMD ["python", "mine_diffs.py"]
|