-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add poetry cache for gamutrf, avoid npm.
- Loading branch information
Showing
9 changed files
with
768 additions
and
712 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
# nosemgrep:github.workflows.config.dockerfile-source-not-pinned | ||
FROM ubuntu:22.04 as installer | ||
ARG POETRY_CACHE | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV PATH="${PATH}:/root/.local/bin" | ||
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. | ||
RUN apt-get update && apt-get install --no-install-recommends -y -q \ | ||
ca-certificates \ | ||
curl \ | ||
|
@@ -21,14 +20,19 @@ RUN apt-get update && apt-get install --no-install-recommends -y -q \ | |
poetry config virtualenvs.create false && \ | ||
python3 -m pip install --no-cache-dir --upgrade pip | ||
COPY --from=iqtlabs/gamutrf-base:latest /usr/local /usr/local | ||
COPY bin/pipcacheconfig.sh /root/pipcacheconfig.sh | ||
COPY gamutrflib /gamutrflib/ | ||
WORKDIR /gamutrflib | ||
RUN if [ "${POETRY_CACHE}" != "" ] ; then /root/pipcacheconfig.sh echo using cache "${POETRY_CACHE}" ; poetry source add --priority=default local "${POETRY_CACHE}" ; fi | ||
RUN poetry install --no-interaction --no-ansi --no-dev | ||
WORKDIR /gamutrf | ||
RUN python3 -c "from gamutrflib.zmqbucket import *" | ||
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 if [ "${POETRY_CACHE}" != "" ] ; then echo using cache "${POETRY_CACHE}" ; poetry source add --priority=default local "${POETRY_CACHE}" ; fi | ||
# TODO: handle caching | ||
RUN for i in bjoern falcon-cors gpsd-py3 RPi.GPIO pycairo ; do poetry run pip install --no-cache-dir "$i"=="$(grep $i pyproject.toml | grep -Eo '\"[0-9\.]+' | sed 's/\"//g')" || exit 1 ; done | ||
RUN if [ "$(arch)" == "aarch64" ] ; then poetry run pip install --no-cache-dir RPi.GPIO=="$(grep RPi.GPIO pyproject.toml | grep -Eo '\"[0-9\.]+' | sed 's/\"//g')" ; fi | ||
RUN poetry install --no-interaction --no-ansi --no-dev --no-root | ||
COPY gamutrf gamutrf/ | ||
COPY bin bin/ | ||
|
@@ -37,6 +41,7 @@ RUN poetry install --no-interaction --no-ansi --no-dev | |
|
||
# nosemgrep:github.workflows.config.dockerfile-source-not-pinned | ||
FROM ubuntu:22.04 | ||
ARG POETRY_CACHE | ||
LABEL maintainer="Charlie Lewis <[email protected]>" | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV UHD_IMAGES_DIR /usr/share/uhd/images | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
if [ "$POETRY_CACHE" == "" ] ; then | ||
echo not using pip cache | ||
exit 0 | ||
fi | ||
|
||
trusted_host=$(echo $POETRY_CACHE|grep -Po '://\K[^/]+') | ||
cat > /etc/pip.conf <<- EOC | ||
[global] | ||
index-url = $POETRY_CACHE | ||
trusted-host = $trusted_host | ||
EOC | ||
|
||
cat /etc/pip.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
# nosemgrep:github.workflows.config.dockerfile-source-not-pinned | ||
FROM ubuntu:22.04 as installer | ||
ARG POETRY_CACHE | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV PATH="${PATH}:/root/.local/bin" | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
# hadolint ignore=DL3008 | ||
RUN apt-get update && \ | ||
apt install -y ca-certificates curl gnupg | ||
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg | ||
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list | ||
RUN apt-get update && apt-get install --no-install-recommends -y -q nodejs | ||
RUN apt-get update && apt-get install --no-install-recommends -y -q \ | ||
ca-certificates \ | ||
curl \ | ||
|
@@ -18,21 +14,26 @@ RUN apt-get update && apt-get install --no-install-recommends -y -q \ | |
libev-dev \ | ||
python3 \ | ||
python3-dev \ | ||
python3-pip && \ | ||
python3-pip \ | ||
unzip \ | ||
wget && \ | ||
curl -sSL https://install.python-poetry.org | python3 - --version 1.7.1 && \ | ||
poetry config virtualenvs.create false | ||
WORKDIR /root | ||
RUN git clone https://github.com/twbs/bootstrap | ||
RUN git clone https://github.com/jquery/jquery | ||
WORKDIR /root/bootstrap | ||
RUN npm install [email protected] | ||
WORKDIR /root/jquery | ||
RUN npm install [email protected] | ||
RUN wget -Ojquery.min.js https://code.jquery.com/jquery-3.7.1.min.js | ||
RUN wget -Obootstrap.zip https://github.com/twbs/bootstrap/releases/download/v5.3.3/bootstrap-5.3.3-dist.zip && \ | ||
unzip bootstrap.zip && \ | ||
cp bootstrap*dist/css/bootstrap.min.css /root && \ | ||
rm bootstrap.zip | ||
WORKDIR /gamutrflib | ||
COPY gamutrflib /gamutrflib/ | ||
RUN if [ "${POETRY_CACHE}" != "" ] ; then echo using cache "${POETRY_CACHE}" ; poetry source add --priority=default local "${POETRY_CACHE}" ; fi | ||
RUN poetry install --no-interaction --no-ansi --no-dev | ||
WORKDIR /gamutrfwaterfall | ||
COPY gamutrfwaterfall /gamutrfwaterfall/ | ||
# TODO: handle caching for pycairo | ||
RUN poetry run pip install --no-cache-dir pycairo=="$(grep pycairo pyproject.toml | grep -Eo '[0-9\.]+')" | ||
RUN if [ "${POETRY_CACHE}" != "" ] ; then echo using cache "${POETRY_CACHE}" ; poetry source add --priority=default local "${POETRY_CACHE}" ; fi | ||
RUN poetry install --no-interaction --no-ansi --no-dev | ||
|
||
FROM ubuntu:22.04 | ||
|
@@ -49,6 +50,6 @@ COPY --from=installer /root/.local /root/.local | |
COPY --from=installer /usr/local /usr/local | ||
COPY --from=installer /gamutrflib /gamutrflib | ||
COPY --from=installer /gamutrfwaterfall /gamutrfwaterfall | ||
COPY --from=installer /root/bootstrap/dist/css/bootstrap.min.css /gamutrfwaterfall/gamutrfwaterfall/static | ||
COPY --from=installer /root/jquery/node_modules/jquery/dist/jquery.min.js /gamutrfwaterfall/gamutrfwaterfall/static | ||
COPY --from=installer /root/bootstrap.min.css /gamutrfwaterfall/gamutrfwaterfall/static | ||
COPY --from=installer /root/jquery.min.js /gamutrfwaterfall/gamutrfwaterfall/static | ||
CMD ["gamutrf-waterfall", "--help"] |
Oops, something went wrong.