make znc better

This commit is contained in:
Jessica Frazelle 2015-01-28 20:54:39 -08:00
parent 5263936bde
commit 9097087265
2 changed files with 13 additions and 29 deletions

View File

@ -7,29 +7,24 @@ RUN apt-get update && apt-get install -y \
libperl-dev \
pkg-config \
curl \
sudo \
--no-install-recommends
ENV HOME /home/user
RUN useradd --create-home --home-dir $HOME user \
&& mkdir -p $HOME/.irssi \
&& chown -R user:user $HOME
# get the source
RUN mkdir /znc-tmp && \
curl -sSL http://znc.in/releases/znc-latest.tar.gz | tar -v -C /znc-tmp -xz && \
mv /znc-tmp/znc* /znc; rm -rf /znc-tmp && \
cd /znc && \
RUN mkdir $HOME/src && \
curl -sSL http://znc.in/releases/znc-latest.tar.gz | tar -v -C $HOME/src -xz --strip-components 1 && \
cd $HOME/src && \
./configure && \
make -j8 && \
make install && \
rm -rf /znc && \
mkdir /znc
rm -rf $HOME/src
COPY ./znc-shim /usr/local/bin/znc-shim
WORKDIR $HOME
USER user
RUN adduser \
--system \
--home=/znc \
--shell=/bin/sh \
--no-create-home \
--group \
znc
WORKDIR /znc
ENTRYPOINT ["/usr/local/bin/znc-shim"]
ENTRYPOINT [ "znc" ]
CMD [ "-f" ]

View File

@ -1,11 +0,0 @@
#!/bin/bash
set -e
ZNC_DIR="/znc"
ZNC_OWNER=$(stat -c "%U" ${ZNC_DIR})
if [ "${ZNC_OWNER}" != "znc" ]; then
chown -R znc:znc ${ZNC_DIR}
fi
exec sudo -u znc "$@"