Added up srvnode script
This commit is contained in:
parent
a8373ca11a
commit
84450546ce
3 changed files with 32 additions and 1 deletions
|
@ -23,7 +23,8 @@ USER $SRV_UID:$SRV_GID
|
|||
ENV PATH "/app/node_modules/.bin:$PATH"
|
||||
|
||||
RUN ln -s /app/.bash_history $HOME/.bash_history \
|
||||
&& ln -s /app/.npmrc $HOME/.npmrc
|
||||
&& ln -s /app/.npmrc $HOME/.npmrc \
|
||||
&& git config --global init.defaultBranch main
|
||||
|
||||
VOLUME /app
|
||||
|
||||
|
|
|
@ -27,3 +27,5 @@ docker.ci/srv/node:latest
|
|||
```shell
|
||||
alias srvnode='docker run --rm -it -v $(pwd):/app docker.ci/srv/node:latest'
|
||||
```
|
||||
|
||||
Alternative you can use the included `srvnode` command in the `ex` directory
|
||||
|
|
28
ex/srvnode
Executable file
28
ex/srvnode
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
DOCKER_RUN_CMD="docker run --rm -it"
|
||||
|
||||
VOLUMES="-v $(pwd):/app"
|
||||
|
||||
if [[ -f "$HOME/.gitconfig" ]]
|
||||
then
|
||||
VOLUMES="$VOLUMES -v $HOME/.gitconfig:/home/node/.gitconfig"
|
||||
fi
|
||||
|
||||
if [[ -d "$HOME/.ssh" ]]
|
||||
then
|
||||
VOLUMES="$VOLUMES -v $HOME/.ssh:/home/node/.ssh"
|
||||
fi
|
||||
|
||||
DOCKER_RUN_CMD="$DOCKER_RUN_CMD $VOLUMES docker.ci/srv/node:latest"
|
||||
|
||||
shift
|
||||
|
||||
if [[ -z "$@" ]]
|
||||
then
|
||||
echo Executing: $DOCKER_RUN_CMD bash
|
||||
exec $DOCKER_RUN_CMD bash
|
||||
else
|
||||
echo Executing: $DOCKER_RUN_CMD $@
|
||||
exec $DOCKER_RUN_CMD $@
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue