-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkiwiirc.Dockerfile
75 lines (65 loc) · 2.78 KB
/
kiwiirc.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# build: docker build --no-cache --progress=plain -t tobi312/tools:kiwiirc -f kiwiirc.Dockerfile .
ARG KIWIIRC_VERSION
FROM alpine:latest as builder
ARG KIWIIRC_VERSION
RUN \
case "$(uname -m)" in \
x86_64|amd64) TARGETARCH="amd64" ;; \
arm64|aarch64) TARGETARCH="arm64" ;; \
armhf|armv7l|armv6l) TARGETARCH="armhf" ;; \
*) echo "unknown arch";; \
esac ; \
echo "TARGETARCH=${TARGETARCH}" \
; \
KIWIIRC_VERSION=${KIWIIRC_VERSION:-$(wget -qO- https://api.github.com/repos/kiwiirc/kiwiirc/releases/latest | grep 'tag_name' | cut -d\" -f4)} ; \
echo "KIWIIRC_VERSION=${KIWIIRC_VERSION}" ; \
KIWIIRC_FILENAME="kiwiirc-server_${KIWIIRC_VERSION}-2_linux_${TARGETARCH}.zip" ; \
wget https://github.com/kiwiirc/kiwiirc/releases/download/${KIWIIRC_VERSION}/${KIWIIRC_FILENAME} ; \
unzip ${KIWIIRC_FILENAME} ; \
rm ${KIWIIRC_FILENAME} ; \
mv kiwiirc_${KIWIIRC_VERSION}-2_linux_${TARGETARCH} kiwiirc
FROM debian:latest
ARG KIWIIRC_VERSION
ARG VCS_REF
ARG BUILD_DATE
LABEL org.opencontainers.image.title="Kiwi IRC" \
org.opencontainers.image.authors="Kiwi IRC Developers, Tobias Hargesheimer <[email protected]>" \
org.opencontainers.image.version="${KIWIIRC_VERSION}" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.revision="${VCS_REF}" \
org.opencontainers.image.description="Kiwi IRC web client: https://kiwiirc.com/ & https://github.com/kiwiirc/kiwiirc" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/tools" \
org.opencontainers.image.source="https://github.com/Tob1as/docker-tools"
COPY --from=builder /kiwiirc /kiwiirc
COPY <<EOF /kiwiirc/docker-entrypoint.sh
#!/bin/sh
if [ -f /kiwiirc/data/config.conf ]; then
ln -sf /kiwiirc/data/config.conf
elif [ -d /kiwiirc/data/ ]; then
cp config.conf /kiwiirc/data/config.conf
ln -sf /kiwiirc/data/config.conf
fi
if [ -f /kiwiirc/data/config.json ]; then
(cd www/static; ln -sf /kiwiirc/data/config.json)
elif [ -d /kiwiirc/data ]; then
cp www/static/config.json /kiwiirc/data
(cd www/static; ln -sf /kiwiirc/data/config.json)
fi
exec "\$@"
EOF
RUN \
sed -i 's/^port = 80\b/port = 8080/' /kiwiirc/config.conf ; \
sed -i 's/^port = 443\b/port = 8443/' /kiwiirc/config.conf ; \
cp /kiwiirc/config.conf /kiwiirc/config.conf.example ; \
cp /kiwiirc/www/static/config.json /kiwiirc/www/static/config.json.example ; \
mkdir -p /kiwiirc/data ; \
chmod +x /kiwiirc/docker-entrypoint.sh ; \
chown -R nobody:nogroup /kiwiirc
WORKDIR /kiwiirc
VOLUME /kiwiirc/data
USER nobody
EXPOSE 8080/tcp 8443/tcp
ENTRYPOINT ["/kiwiirc/docker-entrypoint.sh"]
#CMD ["/kiwiirc/kiwiirc", "-config", "config.conf", "-run", "gateway"]
CMD ["/kiwiirc/kiwiirc"]