2023-07-24 11:36:28 -04:00
|
|
|
FROM python:3.11-slim as build
|
|
|
|
|
|
|
|
ARG VERSION=3.1.0
|
2021-02-16 10:05:11 -05:00
|
|
|
ENV TZ=${TZ:-US/Eastern}
|
2020-12-15 10:27:53 -05:00
|
|
|
ENV LC_ALL=C.UTF-8
|
|
|
|
ENV LANG=C.UTF-8
|
2022-12-12 19:29:45 -05:00
|
|
|
ENV APRSD_PIP_VERSION=${VERSION}
|
2022-11-26 18:23:07 -05:00
|
|
|
|
2023-07-24 11:36:28 -04:00
|
|
|
ENV PIP_DEFAULT_TIMEOUT=100 \
|
|
|
|
# Allow statements and log messages to immediately appear
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
# disable a pip version check to reduce run-time & log-spam
|
|
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
|
|
# cache is useless in docker image, so disable to reduce image size
|
|
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
|
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
# Create a non-root user
|
|
|
|
&& addgroup --system --gid 1001 appgroup \
|
|
|
|
&& useradd --uid 1001 --gid 1001 -s /usr/bin/bash -m -d /app appuser \
|
|
|
|
# Upgrade the package index and install security upgrades
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get upgrade -y \
|
|
|
|
&& apt-get install -y git build-essential curl vim libffi-dev \
|
|
|
|
python3-dev libssl-dev libxml2-dev libxslt-dev telnet sudo \
|
|
|
|
# Install dependencies
|
|
|
|
# Clean up
|
|
|
|
&& apt-get autoremove -y \
|
|
|
|
&& apt-get clean -y
|
|
|
|
|
|
|
|
|
|
|
|
### Final stage
|
|
|
|
FROM build as final
|
|
|
|
WORKDIR /app
|
2020-12-15 10:27:53 -05:00
|
|
|
|
2023-01-31 12:36:39 -05:00
|
|
|
RUN pip3 install aprsd==$APRSD_PIP_VERSION
|
2023-07-24 11:36:28 -04:00
|
|
|
RUN pip install gevent uwsgi
|
|
|
|
RUN which aprsd
|
|
|
|
RUN mkdir /config
|
|
|
|
RUN chown -R appuser:appgroup /app
|
|
|
|
RUN chown -R appuser:appgroup /config
|
|
|
|
USER appuser
|
|
|
|
RUN which aprsd
|
2022-12-27 15:44:32 -05:00
|
|
|
RUN aprsd sample-config > /config/aprsd.conf
|
2020-12-15 10:27:53 -05:00
|
|
|
|
2023-07-24 11:36:28 -04:00
|
|
|
ADD bin/run.sh /app
|
|
|
|
ADD bin/listen.sh /app
|
|
|
|
ADD bin/admin.sh /app
|
|
|
|
|
|
|
|
# For the web admin interface
|
|
|
|
EXPOSE 8001
|
|
|
|
|
|
|
|
ENTRYPOINT ["/app/run.sh"]
|
|
|
|
VOLUME ["/config"]
|
2020-12-15 10:27:53 -05:00
|
|
|
|
2023-07-24 11:36:28 -04:00
|
|
|
# Set the user to run the application
|
|
|
|
USER appuser
|
2021-11-09 08:15:16 -05:00
|
|
|
|
|
|
|
HEALTHCHECK --interval=5m --timeout=12s --start-period=30s \
|
2022-12-31 16:31:40 -05:00
|
|
|
CMD aprsd healthcheck --config /config/aprsd.conf
|