Spaces:
Paused
Paused
fix user
Browse files- Dockerfile +11 -7
Dockerfile
CHANGED
|
@@ -23,11 +23,17 @@ RUN groupadd --system appuser
|
|
| 23 |
# -s /bin/bash: Set the default shell for the user
|
| 24 |
# -g appuser: Set the primary group for the user
|
| 25 |
RUN useradd --system -m -s /bin/bash -g appuser appuser
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# Install nvm (Node Version Manager) and then use it to install Node.js and npm
|
| 29 |
# This ensures a clean and controlled Node.js/npm environment
|
| 30 |
-
ENV NVM_DIR /nvm
|
| 31 |
RUN mkdir -p $NVM_DIR
|
| 32 |
ENV NODE_VERSION 20.17.0
|
| 33 |
# Specify a compatible Node.js version, matching the earlier error message's requirement
|
|
@@ -65,7 +71,7 @@ COPY start_with_sync.sh /start.sh
|
|
| 65 |
RUN chmod +x /app/sync_storage.py /start.sh
|
| 66 |
|
| 67 |
# Set working directory
|
| 68 |
-
WORKDIR /app
|
| 69 |
|
| 70 |
COPY ./add_bash_util.sh /add_bash_util.sh
|
| 71 |
COPY ./Caddyfile /Caddyfile
|
|
@@ -78,10 +84,8 @@ EXPOSE 7860
|
|
| 78 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s \
|
| 79 |
CMD curl -f http://localhost:7860/ || exit 1
|
| 80 |
|
| 81 |
-
# Switch to the new user
|
| 82 |
-
USER appuser
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
# Start with sync
|
| 87 |
ENTRYPOINT ["/start.sh"]
|
|
|
|
| 23 |
# -s /bin/bash: Set the default shell for the user
|
| 24 |
# -g appuser: Set the primary group for the user
|
| 25 |
RUN useradd --system -m -s /bin/bash -g appuser appuser
|
| 26 |
+
# Set the working directory to the user's home directory.
|
| 27 |
+
# All subsequent commands will operate relative to this directory.
|
| 28 |
+
WORKDIR /home/appuser
|
| 29 |
+
# Switch to the new user
|
| 30 |
+
USER appuser
|
| 31 |
+
# Set environment variables for the user (optional)
|
| 32 |
+
ENV HOME=/home/appuser
|
| 33 |
|
| 34 |
# Install nvm (Node Version Manager) and then use it to install Node.js and npm
|
| 35 |
# This ensures a clean and controlled Node.js/npm environment
|
| 36 |
+
ENV NVM_DIR /home/appuser/.nvm
|
| 37 |
RUN mkdir -p $NVM_DIR
|
| 38 |
ENV NODE_VERSION 20.17.0
|
| 39 |
# Specify a compatible Node.js version, matching the earlier error message's requirement
|
|
|
|
| 71 |
RUN chmod +x /app/sync_storage.py /start.sh
|
| 72 |
|
| 73 |
# Set working directory
|
| 74 |
+
# WORKDIR /app
|
| 75 |
|
| 76 |
COPY ./add_bash_util.sh /add_bash_util.sh
|
| 77 |
COPY ./Caddyfile /Caddyfile
|
|
|
|
| 84 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s \
|
| 85 |
CMD curl -f http://localhost:7860/ || exit 1
|
| 86 |
|
|
|
|
|
|
|
| 87 |
|
| 88 |
+
|
| 89 |
+
|
| 90 |
# Start with sync
|
| 91 |
ENTRYPOINT ["/start.sh"]
|