diff --git a/docker/Dockerfile b/docker/Dockerfile index 12b0030..325e9f0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -53,8 +53,9 @@ ADD bin/admin.sh /app # For the web admin interface EXPOSE 8001 -ENTRYPOINT ["/app/run.sh"] VOLUME ["/config"] +ENTRYPOINT ["/app/setup.sh"] +CMD ["server"] # Set the user to run the application USER appuser diff --git a/docker/Dockerfile-dev b/docker/Dockerfile-dev index 94278c1..f6a1a1f 100644 --- a/docker/Dockerfile-dev +++ b/docker/Dockerfile-dev @@ -45,15 +45,18 @@ RUN echo "PATH=\$PATH:/usr/games" >> /app/.bashrc RUN which aprsd RUN aprsd sample-config > /config/aprsd.conf +ADD bin/setup.sh /app ADD bin/run.sh /app ADD bin/listen.sh /app ADD bin/admin.sh /app EXPOSE 8000 +EXPOSE 8001 -# CMD ["gunicorn", "aprsd.wsgi:app", "--host", "0.0.0.0", "--port", "8000"] -ENTRYPOINT ["/app/run.sh"] VOLUME ["/config"] +# CMD ["gunicorn", "aprsd.wsgi:app", "--host", "0.0.0.0", "--port", "8000"] +ENTRYPOINT ["/app/setup.sh"] +CMD ["server"] # Set the user to run the application USER appuser diff --git a/docker/bin/setup.sh b/docker/bin/setup.sh new file mode 100755 index 0000000..00d92b3 --- /dev/null +++ b/docker/bin/setup.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +set -x + +# The default command +# Override the command in docker-compose.yml to change +# what command you want to run in the container +COMMAND="server" + +if [ ! -z "$@" ]; then + COMMAND=$@ +fi + +if [ ! -z "${APRSD_PLUGINS}" ]; then + OLDIFS=$IFS + IFS=',' + echo "Installing pypi plugins '$APRSD_PLUGINS'"; + for plugin in ${APRSD_PLUGINS}; do + IFS=$OLDIFS + # call your procedure/other scripts here below + echo "Installing '$plugin'" + pip3 install --user $plugin + done +fi + +if [ ! -z "${APRSD_EXTENSIONS}" ]; then + OLDIFS=$IFS + IFS=',' + echo "Installing APRSD extensions from pypi '$APRSD_EXTENSIONS'"; + for extension in ${APRSD_EXTENSIONS}; do + IFS=$OLDIFS + # call your procedure/other scripts here below + echo "Installing '$extension'" + pip3 install --user $extension + done +fi + +if [ -z "${LOG_LEVEL}" ] || [[ ! "${LOG_LEVEL}" =~ ^(CRITICAL|ERROR|WARNING|INFO)$ ]]; then + LOG_LEVEL="DEBUG" +fi + +echo "Log level is set to ${LOG_LEVEL}"; + +# check to see if there is a config file +APRSD_CONFIG="/config/aprsd.conf" +if [ ! -e "$APRSD_CONFIG" ]; then + echo "'$APRSD_CONFIG' File does not exist. Creating." + aprsd sample-config > $APRSD_CONFIG +fi + +exec aprsd "${COMMAND}" --config ${APRSD_CONFIG} --loglevel ${LOG_LEVEL} diff --git a/docker/build.sh b/docker/build.sh index d155baa..0a8776c 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -26,7 +26,7 @@ DEV=0 REBUILD_BUILDX=0 TAG="latest" BRANCH=${BRANCH:-master} -VERSION="3.0.0" +VERSION="3.3.4" while getopts “hdart:b:v:” OPTION do