radiosonde_auto_rx/Dockerfile

69 wiersze
1.7 KiB
Docker
Czysty Zwykły widok Historia

2019-10-17 10:00:15 +00:00
# -------------------
# The build container
# -------------------
2021-02-19 16:53:11 +00:00
FROM python:3.7-buster AS build
2019-10-17 10:00:15 +00:00
2021-02-19 16:53:11 +00:00
# Upgrade base packages.
2019-10-17 10:00:15 +00:00
RUN apt-get update && \
apt-get upgrade -y && \
rm -rf /var/lib/apt/lists/*
2021-02-19 16:53:11 +00:00
# Copy in requirements.txt.
COPY auto_rx/requirements.txt \
/root/radiosonde_auto_rx/auto_rx/requirements.txt
2021-02-19 16:53:11 +00:00
# Install Python packages.
RUN pip3 --no-cache-dir install --user --no-warn-script-location \
--extra-index-url https://www.piwheels.org/simple \
-r /root/radiosonde_auto_rx/auto_rx/requirements.txt
# Copy in radiosonde_auto_rx.
COPY . /root/radiosonde_auto_rx
2019-10-17 10:00:15 +00:00
# Build the binaries.
2021-02-19 16:53:11 +00:00
WORKDIR /root/radiosonde_auto_rx/auto_rx
RUN /bin/sh build.sh
2019-10-17 10:00:15 +00:00
# -------------------------
# The application container
# -------------------------
2021-02-19 16:53:11 +00:00
FROM python:3.7-slim-buster
2019-10-12 11:04:00 +00:00
EXPOSE 5000/tcp
2021-02-19 16:53:11 +00:00
# Upgrade base packages and install application dependencies.
RUN case $(uname -m) in \
"armv6l") extra_packages="libatlas3-base libgfortran5" ;; \
"armv7l") extra_packages="libatlas3-base libgfortran5" ;; \
esac && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
libatomic1 \
2019-10-12 11:04:00 +00:00
rng-tools \
rtl-sdr \
2019-10-12 11:04:00 +00:00
sox \
2021-01-05 08:16:51 +00:00
tini \
usbutils \
${extra_packages} && \
rm -rf /var/lib/apt/lists/*
2019-10-12 11:04:00 +00:00
2019-10-17 10:00:15 +00:00
# Copy any additional Python packages from the build container.
2021-02-19 16:53:11 +00:00
COPY --from=build /root/.local /root/.local
2019-10-17 10:00:15 +00:00
# Copy auto_rx from the build container to /opt.
2021-02-19 16:53:11 +00:00
COPY --from=build /root/radiosonde_auto_rx/LICENSE /opt/auto_rx/
COPY --from=build /root/radiosonde_auto_rx/auto_rx/ /opt/auto_rx/
2021-01-05 08:20:00 +00:00
# Set the working directory.
2019-10-12 11:04:00 +00:00
WORKDIR /opt/auto_rx
2021-01-05 08:16:51 +00:00
2021-02-19 16:53:11 +00:00
# Ensure scripts from Python packages are in PATH.
ENV PATH=/root/.local/bin:$PATH
2021-01-05 08:20:00 +00:00
# Use tini as init.
2021-01-05 08:16:51 +00:00
ENTRYPOINT ["/usr/bin/tini", "--"]
# Run auto_rx.py.
2021-02-19 16:53:11 +00:00
CMD ["python3", "/opt/auto_rx/auto_rx.py"]