File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y \
99 curl \
1010 vim \
1111 procps \
12+ gosu \
1213 && rm -rf /var/lib/apt/lists/*
1314
1415# Set working directory
@@ -22,14 +23,26 @@ ARG USERNAME=node
2223ARG USER_UID=1000
2324ARG USER_GID=$USER_UID
2425
25- # Set ownership
26- RUN chown -R $USERNAME:$USERNAME /workspaces
27-
28- # Switch to non-root user
29- USER $USERNAME
26+ # Create directories that will be mounted as volumes
27+ # These will be overridden by volumes, but entrypoint will fix permissions
28+ RUN mkdir -p /workspaces/simplens-core/node_modules \
29+ && mkdir -p /home/$USERNAME/.vscode-server/extensions \
30+ && chown -R $USERNAME:$USERNAME /workspaces \
31+ && chown -R $USERNAME:$USERNAME /home/$USERNAME/.vscode-server
32+
33+ # Create entrypoint script to fix volume permissions
34+ RUN echo '#!/bin/bash\n \
35+ # Fix ownership of mounted volumes (runs as root)\n \
36+ chown -R node:node /workspaces/simplens-core/node_modules 2>/dev/null || true\n \
37+ chown -R node:node /home/node/.vscode-server 2>/dev/null || true\n \
38+ # Execute the main command as the node user\n \
39+ exec gosu node "$@"' > /usr/local/bin/entrypoint.sh \
40+ && chmod +x /usr/local/bin/entrypoint.sh
3041
3142# Default shell
3243ENV SHELL=/bin/bash
3344
45+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh" ]
46+
3447# Keep container running
3548CMD ["sleep" , "infinity" ]
You can’t perform that action at this time.
0 commit comments