refstack-client/docker/env_build.sh
sslypushenko 648b325a59 Add scripts for running refstack-client in docker
Prerequisites:

Linux host with Docker installed.

Usage:

./docker/env_build - script removes previous container if eny and builds
an updated `refstack-client` image
./docker/env_up - script setups environment in container if is the first run
and joins to shell in this container

Basic usage example:

1) Checkout repository
2) Run ./docker/env_build.sh
3) Run ./docker/env_up.sh
...
You will get Bash console in the prepared dockerized environment.

4) Run ./docker/env_up.sh  to get back to shell in the env
5) Run ./docker/env_build.sh to rebuild image and spin a new env
container.

NOTE: These scripts are safe to run locally.

Change-Id: I51e34a5d130d9595ead948f7ddb0db840527a797
2017-05-04 08:56:48 +03:00

22 lines
589 B
Bash
Executable File

#!/bin/bash -x
if [ "$EUID" -eq 0 ]
then echo "This script should not be runned with sudo!"
exit
fi
docker ps &> /dev/null; (( $? != 0 )) && echo 'Docker should be accessible without sudo '
CONTAINER_NAME=refstack_client
if [ $( docker ps -a -q --filter name=${CONTAINER_NAME} ) ]; then
docker rm -f $( docker ps -a -q --filter name=${CONTAINER_NAME} )
fi
docker build -t ${CONTAINER_NAME} \
--build-arg UID=$( id -u $USER ) \
--build-arg GID=$( id -g $USER ) \
--file $( git rev-parse --show-toplevel )/docker/Dockerfile \
$( git rev-parse --show-toplevel )