Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Docker live server

19 Apr 2020 » devenv

https://github.com/duluca/minimal-node-web-server

custom_nameport="cname:8080"
folder=""
container_name=$(echo $custom_nameport | cut -d: -f1)
container_port=$(echo $custom_nameport | cut -d: -f2)
container_name="live-server-${container_name}-p${container_port}"
docker rm -f $container_name
docker run -dit \
    --name $container_name \
    --restart always \
    -p $container_port:3000 \
    -v "$folder":"/usr/src/app/public" \
    duluca/minimal-node-web-server