# Variables IMAGE_NAME="demoap-fe:latest" CONTAINER_NAME="demoap-fe" PORT="9999" HTTP_PROXY="http://42.96.40.255:8002" # http:\/\/0.0.0.0:8002 # Make sure that HTTP_PROXY is not empty if [ -z "$HTTP_PROXY" ] then echo "HTTP_PROXY is empty, you have to specify it in deploy.sh file" exit 1 fi # Replace #proxy_server in nginx.conf with HTTP_PROXY using sed command sed -i "s|#proxy_server|$HTTP_PROXY|g" ./nginx.conf # Replace #port in nginx.conf with PORT using sed command sed -i "s|#port|$PORT|g" ./nginx.conf # Build image docker build --build-arg PORT=$PORT --pull --rm -f "Dockerfile" -t $IMAGE_NAME "." # Remove exist container docker container stop $CONTAINER_NAME # Run container from new image docker run --rm -d -p $PORT:$PORT/tcp --name $CONTAINER_NAME $IMAGE_NAME