Просмотр исходного кода

ensure to make node_modules stored by docker volume

Yuki Takei 5 лет назад
Родитель
Сommit
78a24a150d
2 измененных файлов с 7 добавлено и 4 удалено
  1. 6 4
      .devcontainer/Dockerfile
  2. 1 0
      .devcontainer/docker-compose.yml

+ 6 - 4
.devcontainer/Dockerfile

@@ -5,20 +5,22 @@
 
 FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-12
 
-# The node image includes a non-root user with sudo access. Use the 
-# "remoteUser" property in devcontainer.json to use it. On Linux, update 
+# The node image includes a non-root user with sudo access. Use the
+# "remoteUser" property in devcontainer.json to use it. On Linux, update
 # these values to ensure the container user's UID/GID matches your local values.
 # See https://aka.ms/vscode-remote/containers/non-root-user for details.
 ARG USERNAME=node
 ARG USER_UID=1000
 ARG USER_GID=$USER_UID
 
+RUN mkdir -p /workspace/growi/node_modules
+
 # [Optional] Update UID/GID if needed
 RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
         groupmod --gid $USER_GID $USERNAME \
-        && usermod --uid $USER_UID --gid $USER_GID $USERNAME \
-        && chown -R $USER_UID:$USER_GID /home/$USERNAME /workspace; \
+        && usermod --uid $USER_UID --gid $USER_GID $USERNAME; \
     fi
+RUN chown -R $USER_UID:$USER_GID /home/$USERNAME /workspace;
 
 # *************************************************************
 # * Uncomment this section to use RUN instructions to install *

+ 1 - 0
.devcontainer/docker-compose.yml

@@ -19,6 +19,7 @@ services:
 
     volumes:
       - ..:/workspace/growi:cached
+      - /workspace/growi/node_modules
       - ../../growi-docker-compose:/workspace/growi-docker-compose:cached
       - ../../node_modules:/workspace/node_modules:cached