Created
August 31, 2015 08:53
-
-
Save bartmeuris/ed6a45f9c4d0216649b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
MAINTAINER Bart Meuris | |
RUN apt-get update && \ | |
apt-get -y install irssi irssi-scripts && \ | |
useradd irssi && \ | |
mkdir -p /home/irssi && \ | |
chown -R irssi:irssi /home/irssi && \ | |
mkdir /config && \ | |
chown irssi:irssi /config && \ | |
ln -s /config /home/irssi/.irssi | |
USER irssi | |
ENV HOME /home/irssi | |
ENTRYPOINT [ "/usr/bin/irssi" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IMAGENAME=irssi | |
NAME="irssi-$USER" | |
# Create data container if it does not exist | |
DATANAME="${NAME}-data" | |
if ! docker ps -a | grep -q -- "${DATANAME}"'[ ]*$'; then | |
echo "irssi data container missing - creating..." | |
docker run --name "${DATANAME}" --hostname "${DATANAME}" -v /config --entrypoint /bin/bash $IMAGENAME /bin/bash -c "chown -R irssi:irssi /config" | |
fi | |
NAMES="--name $NAME --hostname $NAME" | |
TIMEZONE="-v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro" | |
# Test if container exists, attach if it does, otherwise start a new-one | |
if docker ps | grep -q -- "${NAME}"'[ ]*$'; then | |
echo "Attaching... (press <C-l> to refresh display)" | |
exec docker attach $NAME | |
elif docker ps -a | grep -q -- "${NAME}"'[ ]*$'; then | |
docker rm $NAME | |
fi | |
exec docker run -t -i --log-driver none --sig-proxy $TIMEZONE --volumes-from "${DATANAME}" $NAMES $IMAGENAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment