improved user managment in client Dockerfile with args
This commit is contained in:
@@ -4,21 +4,26 @@ 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 UID=1000
|
||||
ARG UNAME=gdp
|
||||
ARG GID=1000
|
||||
ARG GNAME=users
|
||||
|
||||
RUN find / -group $UID -exec chgrp -h node {} \;
|
||||
RUN find / -user $UID -exec chown -h node {} \;
|
||||
|
||||
# RUN addgroup -g 1000 gdp && \
|
||||
# adduser -h /home/gdp -D -u 1000 gdp && \
|
||||
RUN adduser -u 1000 -G users -s /bin/sh -D gdp
|
||||
RUN adduser -u $UID -G $GNAME -s /bin/sh -D $UNAME
|
||||
# chown -R gdp:gdp /home/gdp
|
||||
|
||||
USER gdp
|
||||
USER $UNAME
|
||||
|
||||
COPY ./bashrc /home/gdp/.bashrc
|
||||
COPY ./inputrc /home/gdp/.inputrc
|
||||
COPY ./bashrc /home/$UNAME/.bashrc
|
||||
COPY ./inputrc /home/$UNAME/.inputrc
|
||||
|
||||
COPY ./client-entrypoint.sh /usr/local/bin
|
||||
USER root
|
||||
RUN chmod +x /usr/local/bin/client-entrypoint.sh
|
||||
USER gdp
|
||||
USER $UNAME
|
||||
CMD ["/bin/sh","/usr/local/bin/client-entrypoint.sh"]
|
||||
|
||||
@@ -25,6 +25,10 @@ only before the first run (may take some time)
|
||||
```
|
||||
sudo docker-compose build
|
||||
```
|
||||
or with args for groups and users
|
||||
```
|
||||
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) --build-arg UNAME=$(id -g) --build-arg GNAME=$(id -g)
|
||||
```
|
||||
### run
|
||||
then each time you want to launch the app
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user