Only home issues left

parent 28a24610
FROM openjdk:8-jdk
COPY . .
COPY . /usr/src
RUN apt-get update -qq \
&& apt-get install -qqy ant \
&& cd /usr/src \
&& ant -Dhalt.on.plugin.error=true -Dno.package=true -f build/build.xml dist.bin
FROM openjdk:8-jre
COPY --from=0 /target/release/openfire /usr/local/openfire
COPY --from=0 /usr/src/target/release/openfire /usr/local/openfire
COPY --from=0 /usr/src/build/docker/entrypoint.sh /sbin/entrypoint.sh
WORKDIR /usr/local/openfire
#RUN adduser --disabled-login --uid 999 --home /usr/local/openfire --gecos "" openfire \
# && chown -R openfire:openfire /usr/local/openfire
#USER openfire
VOLUME ["/usr/local/openfire/conf", "/usr/local/openfire/embedded-db", "/usr/local/openfire/plugins", "/usr/local/openfire/resources/security"]
CMD ["/usr/local/openfire/bin/openfire.sh"]
ENV OPENFIRE_USER=openfire \
OPENFIRE_DIR=/usr/local/openfire \
OPENFIRE_DATA_DIR=/var/lib/openfire \
OPENFIRE_LOG_DIR=/var/log/openfire
RUN apt-get update -qq \
&& apt-get install -yqq sudo \
&& adduser --disabled-password --quiet --system --home $OPENFIRE_DATA_DIR --gecos "Openfire XMPP server" --group openfire \
&& chmod 755 /sbin/entrypoint.sh \
&& mv ${OPENFIRE_DIR}/conf ${OPENFIRE_DIR}/conf_org \
&& mv ${OPENFIRE_DIR}/plugins ${OPENFIRE_DIR}/plugins_org \
&& mv ${OPENFIRE_DIR}/resources/security ${OPENFIRE_DIR}/resources/security_org \
&& rm -rf /var/lib/apt/lists/*
LABEL maintainer="florian.kinder@fankserver.com"
EXPOSE 3478/tcp 3479/tcp 5222/tcp 5223/tcp 5229/tcp 5275/tcp 5276/tcp 5262/tcp 5263/tcp 7070/tcp 7443/tcp 7777/tcp 9090/tcp 9091/tcp
VOLUME ["${OPENFIRE_DATA_DIR}"]
CMD ["/sbin/entrypoint.sh"]
#!/bin/bash
set -e
rewire_openfire() {
rm -rf ${OPENFIRE_DIR}/{conf,resources/security}
ln -sf ${OPENFIRE_DATA_DIR}/conf ${OPENFIRE_DIR}/
ln -sf ${OPENFIRE_DATA_DIR}/plugins ${OPENFIRE_DIR}/
ln -sf ${OPENFIRE_DATA_DIR}/conf/security ${OPENFIRE_DIR}/resources/
}
initialize_data_dir() {
echo "Initializing ${OPENFIRE_DATA_DIR}..."
mkdir -p ${OPENFIRE_DATA_DIR}
chmod -R 0750 ${OPENFIRE_DATA_DIR}
chown -R ${OPENFIRE_USER}:${OPENFIRE_USER} ${OPENFIRE_DATA_DIR}
# initialize the data volume
if [[ ! -d ${OPENFIRE_DATA_DIR}/conf ]]; then
sudo -HEu ${OPENFIRE_USER} cp -a ${OPENFIRE_DIR}/conf_org ${OPENFIRE_DATA_DIR}/conf
sudo -HEu ${OPENFIRE_USER} cp -a ${OPENFIRE_DIR}/plugins_org ${OPENFIRE_DATA_DIR}/plugins
sudo -HEu ${OPENFIRE_USER} cp -a ${OPENFIRE_DIR}/resources/security_org ${OPENFIRE_DATA_DIR}/conf/security
fi
sudo -HEu ${OPENFIRE_USER} mkdir -p ${OPENFIRE_DATA_DIR}/{plugins,embedded-db}
sudo -HEu ${OPENFIRE_USER} rm -rf ${OPENFIRE_DATA_DIR}/plugins/admin
sudo -HEu ${OPENFIRE_USER} ln -sf ${OPENFIRE_DIR}/plugins_org/admin ${OPENFIRE_DATA_DIR}/plugins/admin
# create version file
CURRENT_VERSION=
[[ -f ${OPENFIRE_DATA_DIR}/VERSION ]] && CURRENT_VERSION=$(cat ${OPENFIRE_DATA_DIR}/VERSION)
if [[ ${OPENFIRE_VERSION} != ${CURRENT_VERSION} ]]; then
echo -n "${OPENFIRE_VERSION}" | sudo -HEu ${OPENFIRE_USER} tee ${OPENFIRE_DATA_DIR}/VERSION >/dev/null
fi
}
initialize_log_dir() {
echo "Initializing ${OPENFIRE_LOG_DIR}..."
mkdir -p ${OPENFIRE_LOG_DIR}
chmod -R 0755 ${OPENFIRE_LOG_DIR}
chown -R ${OPENFIRE_USER}:${OPENFIRE_USER} ${OPENFIRE_LOG_DIR}
rm -rf ${OPENFIRE_DIR}/logs
ln -sf ${OPENFIRE_LOG_DIR} ${OPENFIRE_DIR}/logs
}
# allow arguments to be passed to openfire launch
if [[ ${1:0:1} = '-' ]]; then
EXTRA_ARGS="$@"
set --
fi
rewire_openfire
initialize_data_dir
initialize_log_dir
# default behaviour is to launch openfire
if [[ -z ${1} ]]; then
exec start-stop-daemon --start --chuid ${OPENFIRE_USER}:${OPENFIRE_USER} --exec /usr/bin/java -- \
-server \
-DopenfireHome="${OPENFIRE_DIR}" \
-Dopenfire.lib.dir=${OPENFIRE_DIR}/lib \
-classpath ${OPENFIRE_DIR}/lib/startup.jar \
-jar ${OPENFIRE_DIR}/lib/startup.jar ${EXTRA_ARGS}
else
exec "$@"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment