[smuxi: 80/179] docker/release: update Dockerfile to follow best practice and use ubuntu xenial as base



commit cdb2f4dc63fded4fc33f5080495736ac2862ce66
Author: Pascal Bach <pascal bach nextrem ch>
Date:   Sat Sep 17 15:23:15 2016 +0200

    docker/release: update Dockerfile to follow best practice and use ubuntu xenial as base

 docker/release/Dockerfile |   47 ++++++++++++++++++++------------------------
 docker/release/creds.conf |    2 -
 docker/release/start.sh   |   22 +++++++-------------
 3 files changed, 29 insertions(+), 42 deletions(-)
---
diff --git a/docker/release/Dockerfile b/docker/release/Dockerfile
old mode 100644
new mode 100755
index 2632215..1c38466
--- a/docker/release/Dockerfile
+++ b/docker/release/Dockerfile
@@ -1,6 +1,7 @@
 # Docker scripts for Smuxi
 #
 # Copyright (C) 2014 Carlos Hernandez <carlos techbyte ca>
+# Copytight (C) 2016 Pascal Bach <pascal bach nextrem ch>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,38 +18,32 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 # Builds a docker image for smuxi
-FROM ubuntu:trusty
-MAINTAINER Carlos Hernandez <carlos techbyte ca>
-
-# Let the container know that there is no tty
-ENV DEBIAN_FRONTEND noninteractive
-
-# Set user nobody to uid and gid of unRAID
-RUN usermod -u 99 nobody
-RUN usermod -g 100 nobody
-
-# Set locale
-ENV LANGUAGE en_US.UTF-8
-ENV LANG en_US.UTF-8
-RUN locale-gen en_US en_US.UTF-8
-RUN update-locale LANG=en_US.UTF-8
-RUN dpkg-reconfigure locales
+FROM ubuntu:xenial
+MAINTAINER Pascal Bach <pascal bach nextrem ch>
 
 # Update Ubuntu
-RUN apt-get -q update
-RUN apt-mark hold initscripts udev plymouth mountall
-RUN apt-get -qy --force-yes dist-upgrade
-
-# Install smuxi from apt
-RUN usermod -m -d /config nobody
-RUN apt-get install -qy --force-yes smuxi-engine
+RUN apt-get update && apt-get install -y \
+    smuxi-engine\
+ && rm -rf /var/lib/apt/lists/*
+
+# Add smuxi user
+RUN groupadd --system smuxi &&\
+    useradd --system \
+       --home /var/lib/smuxi \
+       --create-home \
+       --shell /usr/sbin/nologin \
+       -g smuxi smuxi
 
 ADD ./start.sh /start.sh
-ADD ./creds.conf /creds.conf
 RUN chmod a+x  /start.sh
 
-VOLUME /config
+ENV SMUXI_USER username
+ENV SMUXI_PASS password
+
+VOLUME /var/lib/smuxi
+
+EXPOSE 7689
 
 # DON'T RUN AS ROOT
-USER nobody
+USER smuxi
 ENTRYPOINT ["/start.sh"]
diff --git a/docker/release/start.sh b/docker/release/start.sh
old mode 100644
new mode 100755
index 5e5a9db..ffa9cd5
--- a/docker/release/start.sh
+++ b/docker/release/start.sh
@@ -1,19 +1,13 @@
 #! /bin/sh
 
-if [ ! -e /config/creds.conf ]; then
-  cp /creds.conf /config/
-  chown nobody:users /config/creds.conf
-  chmod 755 /config/creds.conf
-fi
-
-user=`grep -E '^user\s' /config/creds.conf  | cut -f 2`
-pass=`grep -E '^pass\s' /config/creds.conf  | cut -f 2`
-
-if smuxi-server --list-users | grep -Fq "$user"
-  then
-  echo "User already exists."
+if smuxi-server --list-users | grep -Fq "$SMUXI_USER"
+then
+  smuxi-server --modify-user --username="$SMUXI_USER" --password="$SMUXI_PASS"
 else
-  smuxi-server --add-user --username="$user" --password="$pass"
+  smuxi-server --add-user --username="$SMUXI_USER" --password="$SMUXI_PASS"
 fi
 
-smuxi-server
+# Make sure we listen on 0.0.0.0
+sed -i 's/BindAddress = 127.0.0.1/BindAddress = 0.0.0.0/g' ~/.config/smuxi/smuxi-engine.ini
+
+smuxi-server -d


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]