Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorder Dockerfile for faster rebuild. #988

Merged
merged 5 commits into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# nosemgrep:github.workflows.config.dockerfile-source-not-pinned
FROM ubuntu:22.04 as installer
COPY --from=iqtlabs/gamutrf-base:latest /usr/local /usr/local
ENV DEBIAN_FRONTEND noninteractive
ENV PATH="${PATH}:/root/.local/bin"
WORKDIR /gamutrf
COPY gamutrf gamutrf/
COPY bin bin/
COPY templates templates/
COPY poetry.lock pyproject.toml README.md /gamutrf/
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# TODO: https://github.com/python-poetry/poetry/issues/3591
# Install pandas via pip to get wheel. Disabling the new installer/configuring a wheel source does not work.
Expand All @@ -25,16 +19,20 @@ RUN apt-get update && apt-get install --no-install-recommends -y -q \
python3-pip && \
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2 && \
poetry config virtualenvs.create false && \
python3 -m pip install --no-cache-dir --upgrade pip && \
poetry run pip install --no-cache-dir pandas==$(grep pandas pyproject.toml | grep -Eo "[0-9\.]+") && \
poetry install --no-interaction --no-dev --no-ansi
python3 -m pip install --no-cache-dir --upgrade pip
COPY --from=iqtlabs/gamutrf-base:latest /usr/local /usr/local
WORKDIR /gamutrf
COPY poetry.lock pyproject.toml README.md /gamutrf/
RUN poetry run pip install --no-cache-dir pandas=="$(grep pandas pyproject.toml | grep -Eo '[0-9\.]+')"
# dependency install is cached for faster rebuild, if only gamutrf source changed.
RUN poetry install --no-interaction --no-ansi --no-dev --no-root
COPY gamutrf gamutrf/
COPY bin bin/
COPY templates templates/
RUN poetry install --no-interaction --no-ansi --no-dev

# nosemgrep:github.workflows.config.dockerfile-source-not-pinned
FROM ubuntu:22.04
COPY --from=iqtlabs/gnuradio:3.10.8 /usr/share/uhd/images /usr/share/uhd/images
COPY --from=installer /usr/local /usr/local
COPY --from=installer /gamutrf /gamutrf
COPY --from=installer /root/.local /root/.local
LABEL maintainer="Charlie Lewis <[email protected]>"
ENV DEBIAN_FRONTEND noninteractive
ENV UHD_IMAGES_DIR /usr/share/uhd/images
Expand Down Expand Up @@ -81,6 +79,11 @@ RUN if [ "$(arch)" = "x86_64" ] ; then \
wget \
zstd && \
apt-get -y -q clean && rm -rf /var/lib/apt/lists/*
COPY --from=iqtlabs/gnuradio:3.10.8 /usr/share/uhd/images /usr/share/uhd/images
COPY --from=installer /usr/local /usr/local
COPY --from=installer /gamutrf /gamutrf
COPY --from=installer /root/.local /root/.local
RUN ldconfig -v
WORKDIR /gamutrf
RUN echo "$(find /gamutrf/gamutrf -type f -name \*py -print)"|xargs grep -Eh "^(import|from)\s"|grep -Ev "gamutrf"|sort|uniq|python3
RUN ldd /usr/local/bin/uhd_sample_recorder
Expand Down
Loading