-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathdev-container.sh
28 lines (23 loc) · 1.26 KB
/
dev-container.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
#################################################################
# #
# Simple Bash script to simplify development in a container. #
# Builds Dockerfile.dev if it does not already exists. #
# The CWD is mounted in the container. #
# #
# Use --rebuild flag to force rebuild of the image even if #
# (a potentially older version of) the image already exists. #
# This is necessary if e.g. the dependencies are updated. #
# #
#################################################################
rebuild=$([[ $1 == '--rebuild' ]] && echo true || echo false)
if [[ $rebuild == true ]]
then
docker build --build-arg UID=$UID --build-arg USER=$USER -t ob-dev -f Dockerfile.dev .
else
docker inspect --type=image ob-dev &> /dev/null || {
echo "Image doesn't exist locally, building ...";
docker build --build-arg UID=$UID --build-arg USER=$USER -t ob-dev -f Dockerfile.dev .
}
fi
docker run -it --workdir /workspace -v $PWD:/workspace -v $HOME/.gitconfig:$HOME/.gitconfig -v $HOME/.ssh:$HOME/.ssh ob-dev bash