Skip to content

Commit 34f9602

Browse files
committed
CI: Clean up build time
1 parent 261c8ab commit 34f9602

File tree

1 file changed

+6
-45
lines changed

1 file changed

+6
-45
lines changed

.circleci/config.yml

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -95,45 +95,8 @@ jobs:
9595
- run: *docker_auth
9696
- run: *setup_docker_registry
9797
- run:
98-
name: Save Docker registry
99-
command: |
100-
if [[ ! -f /tmp/images/registry.tar.gz ]]; then
101-
mkdir -p /tmp/images
102-
docker save registry:2 | gzip > /tmp/images/registry.tar.gz
103-
fi
104-
- run:
105-
name: Pull base image (ubuntu:focal)
106-
command: |
107-
set +e
108-
docker pull localhost:5000/ubuntu
109-
success=$?
110-
set -e
111-
if [[ "$success" = "0" ]]; then
112-
echo "Pulling from local registry"
113-
docker tag localhost:5000/ubuntu ubuntu:focal
114-
else
115-
echo "Pulling from Docker Hub"
116-
docker pull ubuntu:focal
117-
docker tag ubuntu:focal localhost:5000/ubuntu
118-
docker push localhost:5000/ubuntu
119-
fi
120-
- run:
121-
name: Pull nibabies image (nipreps/nibabies)
122-
command: |
123-
set +e
124-
docker pull localhost:5000/nibabies
125-
success=$?
126-
set -e
127-
if [[ "$success" = "0" ]]; then
128-
echo "Pulled from local registry"
129-
docker tag localhost:5000/nibabies nipreps/nibabies:dev
130-
docker tag localhost:5000/nibabies nipreps/nibabies
131-
else
132-
echo "Pulling unstable from Docker Hub"
133-
docker pull nipreps/nibabies:unstable
134-
docker tag nipreps/nibabies:unstable nipreps/nibabies:dev
135-
docker tag nipreps/nibabies:unstable nipreps/nibabies
136-
fi
98+
name: Create Docker builder
99+
command: docker buildx create --use --name=builder --driver=docker-container
137100
- run:
138101
name: Clean and check images (before build)
139102
command: |
@@ -155,15 +118,13 @@ jobs:
155118
echo "them to your fork with ``git push origin --tags``"
156119
fi
157120
# Build docker image
158-
e=1 && for i in {1..3}; do
159-
docker build --rm \
160-
--cache-from=nipreps/nibabies:dev \
121+
docker buildx build --load --builder builder \
122+
--cache-from localhost:5000/nibabies \
123+
--cache-from nipreps/nibabies:dev \
161124
-t nipreps/nibabies:dev \
162125
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
163126
--build-arg VCS_REF=`git rev-parse --short HEAD` \
164-
--build-arg VERSION="${CIRCLE_TAG:-$THISVERSION}" . \
165-
&& e=0 && break || sleep 15
166-
done && [ "$e" -eq "0" ]
127+
--build-arg VERSION="${CIRCLE_TAG:-$THISVERSION}" .
167128
- run:
168129
name: Check Docker images (after build)
169130
command: docker images

0 commit comments

Comments
 (0)