Skip to content

Commit

Permalink
Invalidate image cache on git clones (#242)
Browse files Browse the repository at this point in the history
Adds lines to the dockerfile that make sure the cache is not used if remote repositories of ngen and troute have been updated
  • Loading branch information
JoshCu authored Nov 27, 2024
1 parent 4301377 commit 70ee857
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /ngen/
RUN pip3 install uv && uv venv
ENV PATH="/ngen/.venv/bin:$PATH"
## make sure clone isn't cached if repo is updated
ADD https://api.github.com/repos/${TROUTE_REPO}/git/refs/heads/${TROUTE_BRANCH} /tmp/version.json
# install requirements like this so the troute clone can run in parallel with ngen download and build
RUN uv pip install -r https://raw.githubusercontent.com/$TROUTE_REPO/refs/heads/$TROUTE_BRANCH/requirements.txt
# this installs numpy 1.26.4 but the produced wheels install a non pinned version
Expand Down Expand Up @@ -67,6 +69,8 @@ RUN uv build --wheel --no-build-isolation src/troute-nwm/

FROM troute_prebuild AS ngen_clone
WORKDIR /ngen
## make sure clone isn't cached if repo is updated
ADD https://api.github.com/repos/${NGEN_REPO}/git/refs/heads/${NGEN_BRANCH} /tmp/version.json
RUN git clone --single-branch --branch $NGEN_BRANCH https://github.com/$NGEN_REPO.git && \
cd ngen && \
git submodule update --init --recursive --depth 1
Expand Down

0 comments on commit 70ee857

Please sign in to comment.