added node container for webpack build

This commit is contained in:
Bachir Soussi Chiadmi 2020-11-03 11:23:49 +01:00
parent dce19c42fe
commit c5757c47e2
6 changed files with 61 additions and 0 deletions

30
Docker/npm/Dockerfile Normal file
View File

@ -0,0 +1,30 @@
FROM node:lts-alpine
RUN apk update && apk --no-cache add shadow && \
usermod -u 1001 node && \
groupmod -g 1001 node
RUN find / -group 1000 -exec chgrp -h node {} \;
RUN find / -user 1000 -exec chown -h node {} \;
ARG USER_UID
ARG USER_UNAME
ARG USER_GID
ARG USER_GNAME
# RUN addgroup -g 1000 gdp && \
# adduser -h /home/gdp -D -u 1000 gdp && \
RUN adduser -u ${USER_UID} -G users -s /bin/sh -D ${USER_UNAME}
# chown -R gdp:gdp /home/gdp
USER ${USER_UNAME}
COPY ./bashrc /home/${USER_UNAME}/.bashrc
COPY ./inputrc /home/${USER_UNAME}/.inputrc
COPY ./client-entrypoint.sh /usr/local/bin
USER root
RUN chmod +x /usr/local/bin/client-entrypoint.sh
USER ${USER_UNAME}
CMD ["/bin/sh","/usr/local/bin/client-entrypoint.sh"]

3
Docker/npm/bashrc Normal file
View File

@ -0,0 +1,3 @@
PS1='\e[36m\e[1mNODE\e[0m:\e[90m\w\e[0m\n$ '
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

View File

@ -0,0 +1,13 @@
#!/bin/sh
# cat /etc/passwd|grep 1000
cd /app
echo "Cleaning node_modules"
rm -rf node_modules
echo "Npm install"
npm install
echo "Run npm dev"
npm run dev

2
Docker/npm/inputrc Normal file
View File

@ -0,0 +1,2 @@
set show-all-if-ambiguous on
set completion-ignore-case on

View File

@ -36,6 +36,9 @@ down:
exec_php:
docker exec -it materiod8_php_1 bash
exec_npm:
docker exec -it materiod8_npm_1 sh
exec_mysql:
docker exec -it materiod8_mysql_1 bash

View File

@ -156,6 +156,15 @@ services:
depends_on:
- php-legacy
npm:
build: ./Docker/npm
user: ${USER_UID}:${USER_GID}
volumes:
- "${PROJECT_ROOT}:/app"
- npm-user-data:/home/${USER_UNAME}
ports:
- 8788:8788
working_dir: "/app"
volumes:
php-user-data:
@ -166,6 +175,7 @@ volumes:
redis-legacy-data:
solr-cores-legacy:
solr-cores:
npm-user-data:
networks:
database: