28 lines
492 B
Bash
28 lines
492 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
IMAGE_NAME=buildbot-master
|
||
|
CONTAINER_NAME=buildbot-master
|
||
|
|
||
|
HOST_DIR=/srv/buildbot-master
|
||
|
SLAVE_DIR=/buildbot
|
||
|
|
||
|
docker build -t $IMAGE_NAME .
|
||
|
|
||
|
docker rm -f $CONTAINER_NAME
|
||
|
|
||
|
OLD_IMG=$(docker images | grep '^$IMAGE_NAME' | grep '<none>' | awk '{print $3}')
|
||
|
|
||
|
if [ ! -z "$OLD_IMG" ]; then
|
||
|
docker rmi $OLD_IMG
|
||
|
fi
|
||
|
|
||
|
docker run \
|
||
|
--detach \
|
||
|
--restart always \
|
||
|
--publish 8010:8010 \
|
||
|
--publish 9989:9989 \
|
||
|
--name $CONTAINER_NAME \
|
||
|
--volume $HOST_DIR:$SLAVE_DIR \
|
||
|
$IMAGE_NAME:latest
|
||
|
|