mirror of
https://github.com/jimeh/docker-znc.git
synced 2026-02-19 09:56:43 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 48fb699f4b | |||
| 3dfefba576 | |||
|
|
4e6a5d4dc7 | ||
| 5a826aad15 | |||
| cc821dec0c | |||
| 01d3e5eb53 | |||
| 8712e23e5e | |||
| b3bca7ee0b | |||
| 01796adb43 | |||
| bfc867af73 | |||
| 3269e67261 |
46
Dockerfile
46
Dockerfile
@@ -1,19 +1,33 @@
|
|||||||
# version 0.0.2
|
# version 1.6.1-1
|
||||||
# docker-version 0.7.6
|
# docker-version 1.8.2
|
||||||
FROM ubuntu:12.04
|
FROM ubuntu:15.04
|
||||||
MAINTAINER Jim Myhrberg "contact@jimeh.me"
|
MAINTAINER Jim Myhrberg "contact@jimeh.me"
|
||||||
|
|
||||||
# We use a bootstrap script to avoid having temporary cache files and build
|
ENV ZNC_VERSION 1.6.1
|
||||||
# dependencies being committed and included into the docker image.
|
|
||||||
ADD bootstrap.sh /tmp/
|
|
||||||
RUN chmod +x /tmp/bootstrap.sh && /tmp/bootstrap.sh
|
|
||||||
|
|
||||||
RUN useradd znc
|
RUN apt-get update \
|
||||||
ADD start-znc /usr/local/bin/
|
&& apt-get install -y sudo wget build-essential libssl-dev libperl-dev \
|
||||||
ADD znc.conf.default /src/
|
pkg-config swig3.0 libicu-dev \
|
||||||
RUN chmod 644 /src/znc.conf.default
|
&& mkdir -p /src \
|
||||||
|
&& cd /src \
|
||||||
|
&& wget "http://znc.in/releases/archive/znc-${ZNC_VERSION}.tar.gz" \
|
||||||
|
&& tar -zxf "znc-${ZNC_VERSION}.tar.gz" \
|
||||||
|
&& cd "znc-${ZNC_VERSION}" \
|
||||||
|
&& ./configure \
|
||||||
|
&& make \
|
||||||
|
&& make install \
|
||||||
|
&& apt-get remove -y wget \
|
||||||
|
&& apt-get autoremove -y \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /src* /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
USER znc
|
RUN useradd znc
|
||||||
EXPOSE 6667
|
ADD docker-entrypoint.sh /entrypoint.sh
|
||||||
ENTRYPOINT ["/usr/local/bin/start-znc"]
|
ADD znc.conf.default /znc.conf.default
|
||||||
CMD [""]
|
RUN chmod 644 /znc.conf.default
|
||||||
|
|
||||||
|
VOLUME /znc-data
|
||||||
|
|
||||||
|
EXPOSE 6667
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
CMD [""]
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -1,7 +1,4 @@
|
|||||||
build:
|
build:
|
||||||
docker build -t ${USER}/znc .
|
docker build -t ${USER}/znc .
|
||||||
|
|
||||||
push: build
|
.PHONY: build
|
||||||
docker push ${USER}/znc
|
|
||||||
|
|
||||||
.PHONY: default
|
|
||||||
|
|||||||
46
README.md
46
README.md
@@ -6,15 +6,16 @@ Run the [ZNC](http://znc.in) IRC Bouncer in a Docker container.
|
|||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
1. Install [Docker](http://docker.io/).
|
1. Install [Docker](http://docker.io/).
|
||||||
2. Make .znc folder: `mkdir /home/$(whoami)/.znc`
|
2. Make .znc folder: `mkdir $HOME/.znc`
|
||||||
|
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
To retain your ZNC settings between runs, you will need to bind a directory
|
To retain your ZNC settings between runs, you'll most likely want to
|
||||||
from the host to `/znc-data` in the container. For example:
|
bind a directory from the host to `/znc-data` in the container. For
|
||||||
|
example:
|
||||||
|
|
||||||
docker run -d -p 6667 -v /home/$(whoami)/.znc:/znc-data jimeh/znc
|
docker run -d -p 6667 -v $HOME/.znc:/znc-data jimeh/znc
|
||||||
|
|
||||||
This will download the image if needed, and create a default config file in
|
This will download the image if needed, and create a default config file in
|
||||||
your data directory unless you already have a config in place. The default
|
your data directory unless you already have a config in place. The default
|
||||||
@@ -25,7 +26,7 @@ exposed:
|
|||||||
|
|
||||||
Or if you want to specify which port to map the default 6667 port to:
|
Or if you want to specify which port to map the default 6667 port to:
|
||||||
|
|
||||||
docker run -d -p 36667:6667 -v /home/$(whoami)/.znc:/znc-data jimeh/znc
|
docker run -d -p 36667:6667 -v $HOME/.znc:/znc-data jimeh/znc
|
||||||
|
|
||||||
Resulting in port 36667 on the host mapping to 6667 within the container.
|
Resulting in port 36667 on the host mapping to 6667 within the container.
|
||||||
|
|
||||||
@@ -53,9 +54,38 @@ configuration without having to worry about building them. And it only slows
|
|||||||
down ZNC's startup with a few seconds.
|
down ZNC's startup with a few seconds.
|
||||||
|
|
||||||
|
|
||||||
|
## Notes on DATADIR
|
||||||
|
|
||||||
|
ZNC needs a data/config directory to run. Within the container it uses
|
||||||
|
`/znc-data`, so to retain this data when shutting down a container, you should
|
||||||
|
mount a directory from the host. Hence `-v $HOME/.znc:/znc-data` is part of
|
||||||
|
the instructions above.
|
||||||
|
|
||||||
|
As ZNC needs to run as it's own user within the container, the directory will
|
||||||
|
have it's ownership changed to UID 1000 (user) and GID 1000 (group). Meaning
|
||||||
|
after the first run, you might need root access to manually modify the data
|
||||||
|
directory.
|
||||||
|
|
||||||
|
|
||||||
|
## Passing Custom Arguments to ZNC
|
||||||
|
|
||||||
|
As `docker run` passes all arguments after the image name to the entrypoint
|
||||||
|
script, the [start-znc][] script simply passes all arguments along to ZNC.
|
||||||
|
|
||||||
|
[start-znc]: https://github.com/jimeh/docker-znc/blob/master/start-znc
|
||||||
|
|
||||||
|
For example, if you want to use the `--makepass` option, you would run:
|
||||||
|
|
||||||
|
docker run -i -t -v $HOME/.znc:/znc-data jimeh/znc --makepass
|
||||||
|
|
||||||
|
Make note of the use of `-i` and `-t` instead of `-d`. This attaches us to the
|
||||||
|
container, so we can interact with ZNC's makepass process. With `-d` it would
|
||||||
|
simply run in the background.
|
||||||
|
|
||||||
|
|
||||||
## Building It Yourself
|
## Building It Yourself
|
||||||
|
|
||||||
0. Follow Prerequisites above.
|
1. Follow Prerequisites above.
|
||||||
1. Checkout source: `git clone https://github.com/jimeh/docker-znc.git && cd docker-znc`
|
2. Checkout source: `git clone https://github.com/jimeh/docker-znc.git && cd docker-znc`
|
||||||
3. Build container: `sudo docker build -t $(whoami)/znc .`
|
3. Build container: `sudo docker build -t $(whoami)/znc .`
|
||||||
4. Run container: `sudo docker run -d -p 6667 -v /home/$(whoami)/.znc:/znc-data $(whoami)/znc`
|
4. Run container: `sudo docker run -d -p 6667 -v $HOME/.znc:/znc-data $(whoami)/znc`
|
||||||
|
|||||||
14
bootstrap.sh
14
bootstrap.sh
@@ -1,14 +0,0 @@
|
|||||||
#! /usr/bin/env bash
|
|
||||||
|
|
||||||
# Install
|
|
||||||
apt-get install -y python-software-properties
|
|
||||||
add-apt-repository ppa:teward/znc
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y znc znc-dbg znc-dev znc-perl znc-python znc-tcl
|
|
||||||
apt-get install -y znc znc-dbg znc-dev znc-extra znc-perl znc-python znc-tcl
|
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
apt-get remove -y python-software-properties
|
|
||||||
apt-get autoremove -y
|
|
||||||
apt-get clean
|
|
||||||
@@ -24,8 +24,12 @@ fi
|
|||||||
# Create default config if it doesn't exist
|
# Create default config if it doesn't exist
|
||||||
if [ ! -f "${DATADIR}/configs/znc.conf" ]; then
|
if [ ! -f "${DATADIR}/configs/znc.conf" ]; then
|
||||||
mkdir -p "${DATADIR}/configs"
|
mkdir -p "${DATADIR}/configs"
|
||||||
cp /src/znc.conf.default "${DATADIR}/configs/znc.conf"
|
cp /znc.conf.default "${DATADIR}/configs/znc.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make sure $DATADIR is owned by znc user. This effects ownership of the
|
||||||
|
# mounted directory on the host machine too.
|
||||||
|
chown -R znc:znc "$DATADIR"
|
||||||
|
|
||||||
# Start ZNC.
|
# Start ZNC.
|
||||||
exec znc --foreground --datadir="$DATADIR" $@
|
exec sudo -u znc znc --foreground --datadir="$DATADIR" $@
|
||||||
@@ -3,30 +3,32 @@
|
|||||||
// Do NOT edit this file while ZNC is running!
|
// Do NOT edit this file while ZNC is running!
|
||||||
// Use webadmin or *controlpanel instead.
|
// Use webadmin or *controlpanel instead.
|
||||||
//
|
//
|
||||||
// Buf if you feel risky, you might want to read help on /znc saveconfig and /znc rehash.
|
// Altering this file by hand will forfeit all support.
|
||||||
|
//
|
||||||
|
// But if you feel risky, you might want to read help on /znc saveconfig and /znc rehash.
|
||||||
// Also check http://en.znc.in/wiki/Configuration
|
// Also check http://en.znc.in/wiki/Configuration
|
||||||
|
|
||||||
Version = 1.0
|
Version = 1.6.1
|
||||||
<Listener l>
|
<Listener l>
|
||||||
Port = 6667
|
Port = 6667
|
||||||
IPv4 = true
|
IPv4 = true
|
||||||
IPv6 = true
|
IPv6 = true
|
||||||
SSL = false
|
SSL = false
|
||||||
</Listener>
|
</Listener>
|
||||||
LoadModule = webadmin
|
LoadModule = webadmin
|
||||||
|
|
||||||
<User admin>
|
<User admin>
|
||||||
Pass = sha256#0ff9dbecce6e6a60031937e471b4911c3c3b32e9545b7c2868c22152da4f109d#pvcfXcnF/BjsXVU:Z9;-#
|
Pass = sha256#00793765305dfc3e7bba28267fe9d9e2c721ebef4e20f3a89720265a89ee6a4f#N!lgZM8S.HZ4zH?)vFoW#
|
||||||
Admin = true
|
Admin = true
|
||||||
Nick = admin
|
Nick = admin
|
||||||
AltNick = admin_
|
AltNick = admin_
|
||||||
Ident = admin
|
Ident = admin
|
||||||
RealName = Got ZNC?
|
RealName = Got ZNC?
|
||||||
Buffer = 50
|
Buffer = 50
|
||||||
AutoClearChanBuffer = true
|
AutoClearChanBuffer = true
|
||||||
ChanModes = +stn
|
ChanModes = +stn
|
||||||
|
|
||||||
LoadModule = chansaver
|
LoadModule = chansaver
|
||||||
LoadModule = controlpanel
|
LoadModule = controlpanel
|
||||||
LoadModule = perform
|
LoadModule = perform
|
||||||
</User>
|
</User>
|
||||||
|
|||||||
Reference in New Issue
Block a user