mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 11:31:49 +01:00
cleanup
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
4206fabebd
commit
9d7d50acdb
|
@ -11,6 +11,33 @@ RUN apt-get update && apt-get install -y \
|
|||
--no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# install gosu
|
||||
ENV GOSU_VERSION 1.10
|
||||
RUN set -ex; \
|
||||
\
|
||||
fetchDeps=' \
|
||||
wget \
|
||||
'; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends $fetchDeps; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
\
|
||||
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
|
||||
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
|
||||
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
|
||||
\
|
||||
# verify the signature
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
|
||||
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
|
||||
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
|
||||
\
|
||||
chmod +x /usr/local/bin/gosu; \
|
||||
# verify that the binary works
|
||||
gosu nobody true; \
|
||||
\
|
||||
apt-get purge -y --auto-remove $fetchDeps
|
||||
|
||||
# add mongo repo
|
||||
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 \
|
||||
&& echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" >> /etc/apt/sources.list.d/mongo.list
|
||||
|
@ -47,4 +74,7 @@ RUN buildDeps=' \
|
|||
WORKDIR /config
|
||||
EXPOSE 8080 8081 8443 8843 8880
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "entrypoint.sh" ]
|
||||
CMD ["java", "-Xmx1024M", "-jar", "/usr/lib/unifi/lib/ace.jar", "start"]
|
||||
|
|
37
unifi/entrypoint.sh
Executable file
37
unifi/entrypoint.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# Create the folder heirarchy.
|
||||
mkdir -p /config/{data,logs,run}
|
||||
|
||||
# Create symlinks for the config
|
||||
if [[ -L /usr/lib/unifi/data && ! /usr/lib/unifi/data -ef /config/data ]]; then
|
||||
unlink /usr/lib/unifi/data
|
||||
fi
|
||||
if [[ -L /usr/lib/unifi/logs && ! /usr/lib/unifi/logs -ef /config/logs ]]; then
|
||||
unlink /usr/lib/unifi/logs
|
||||
fi
|
||||
if [[ -L /usr/lib/unifi/run && ! /usr/lib/unifi/run -ef /config/run ]]; then
|
||||
unlink /usr/lib/unifi/run
|
||||
fi
|
||||
if [[ ! -L /usr/lib/unifi/data ]]; then
|
||||
ln -s /config/data /usr/lib/unifi/data
|
||||
fi
|
||||
if [[ ! -L /usr/lib/unifi/logs ]]; then
|
||||
ln -s /config/logs /usr/lib/unifi/logs
|
||||
fi
|
||||
if [[ ! -L /usr/lib/unifi/run ]]; then
|
||||
ln -s /config/run /usr/lib/unifi/run
|
||||
fi
|
||||
|
||||
# Generate a key if it doesn't exist.
|
||||
if [[ ! -f /config/data/keystore ]]; then
|
||||
keytool -genkey -keyalg RSA -alias unifi -keystore /config/data/keystore \
|
||||
-storepass aircontrolenterprise -keypass aircontrolenterprise -validity 1825 \
|
||||
-keysize 4096 -dname "cn=unifi"
|
||||
fi
|
||||
|
||||
chown -R unifi:unifi /config /usr/lib/unifi
|
||||
|
||||
exec gosu unifi $@
|
Loading…
Reference in New Issue
Block a user