Skip to content

Commit

Permalink
fix: clean up environment cache
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed May 17, 2024
1 parent 7cef99c commit 76a5092
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
28 changes: 8 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
- checkout
- restore_cache:
keys:
- env-v3-{{ .Branch }}-
- env-v3-master-
- env-v3-
- env-v5-{{ .Branch }}-
- env-v5-master-
- env-v5-
- run:
name: Setup git-annex
command: |
Expand All @@ -29,17 +29,14 @@ jobs:
- run:
name: Setup DataLad
command: |
export PY3=$(pyenv versions | grep '3\.' |
sed -e 's/.* 3\./3./' -e 's/ .*//')
pyenv local $PY3
python -m pip install --no-cache-dir -U pip "setuptools >= 45.0" "setuptools_scm[toml] >= 3.4"
python -m pip install --no-cache-dir -U datalad datalad-osf
python3 -m pip install --no-cache-dir -U pip "setuptools >= 45.0" "setuptools_scm[toml] >= 3.4"
python3 -m pip install --no-cache-dir -U datalad datalad-osf
- save_cache:
key: env-v3-{{ .Branch }}-{{ .BuildNum }}
key: env-v5-{{ .Branch }}-{{ .BuildNum }}
paths:
- /opt/circleci/git-annex.linux
- /opt/circleci/.pyenv/versions/3.9.4
- /opt/circleci/.pyenv/versions/3.12.2

- restore_cache:
keys:
Expand All @@ -49,10 +46,7 @@ jobs:
- run:
name: Install test data from GIN
command: |
export PY3=$(pyenv versions | grep '3\.' |
sed -e 's/.* 3\./3./' -e 's/ .*//')
pyenv local $PY3
export PATH=/opt/circleci/git-annex.linux:$PATH
export PATH=/opt/circleci/.pyenv/versions/3.12.2/bin/:/opt/circleci/git-annex.linux:$PATH
mkdir -p /tmp/data
cd /tmp/data
datalad install -r https://gin.g-node.org/oesteban/nitransforms-tests
Expand Down Expand Up @@ -98,9 +92,6 @@ jobs:
name: Build Docker image & push to registry
no_output_timeout: 60m
command: |
export PY3=$(pyenv versions | grep '3\.' |
sed -e 's/.* 3\./3./' -e 's/ .*//')
pyenv local $PY3
e=1 && for i in {1..5}; do
docker build --rm --cache-from=nitransforms:latest \
-t nitransforms:latest \
Expand All @@ -123,9 +114,6 @@ jobs:
- run:
name: Check version packaged in Docker image
command: |
export PY3=$(pyenv versions | grep '3\.' |
sed -e 's/.* 3\./3./' -e 's/ .*//')
pyenv local $PY3
THISVERSION=${CIRCLE_TAG:-$(python3 setup.py --version)}
INSTALLED_VERSION=$(\
docker run -it --rm --entrypoint=python nitransforms \
Expand Down
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
FROM ubuntu:xenial-20200114
FROM ubuntu:jammy-20240125

#
# Build wheel
#
FROM python:slim AS src
RUN pip install build
RUN apt-get update && \
apt-get install -y --no-install-recommends git
COPY . /src
RUN python -m build /src


# Pre-cache neurodebian key
COPY docker/files/neurodebian.gpg /usr/local/etc/neurodebian.gpg
Expand Down Expand Up @@ -139,8 +150,8 @@ ENV HOME="/home/neuro"
# Install package
# CRITICAL: Make sure python setup.py --version has been run at least once
# outside the container, with access to the git history.
COPY . /src/nitransforms
RUN pip install --no-cache-dir "/src/nitransforms[all]"
COPY --from=src /src/dist/*.whl .
RUN python -m pip install --no-cache-dir $( ls *.whl )[all]

RUN find $HOME -type d -exec chmod go=u {} + && \
find $HOME -type f -exec chmod go=u {} +
Expand Down

0 comments on commit 76a5092

Please sign in to comment.