Skip to content

Commit

Permalink
generate dockerfiles in ci + rm dockerfiles
Browse files Browse the repository at this point in the history
- do not store dockerfiles in repo
- cache base dockerfile in deploy step that was generated in `compare_base_dockerfiles` step
- use global `working_directory`
  • Loading branch information
jakubk committed Nov 15, 2017
1 parent 126831e commit 28547cc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 461 deletions.
24 changes: 11 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ jobs:
steps:
- checkout:
path: /home/circleci/nipype
- setup_remote_docker
- run:
name: Prune base Dockerfile in preparation for cache check
name: Generate and prune base Dockerfile in preparation for cache check
working_directory: /home/circleci/nipype/docker
command: |
mkdir -p /tmp/docker
ash ./generate_dockerfiles.sh -b
# Use the sha256 sum of the pruned Dockerfile as the cache key.
ash prune_dockerfile.sh Dockerfile.base > /tmp/docker/Dockerfile.base-pruned
- restore_cache:
Expand All @@ -29,6 +32,7 @@ jobs:
- persist_to_workspace:
root: /tmp
paths:
- docker/Dockerfile.base-pruned
- docker/get_base_image.sh


Expand All @@ -37,26 +41,26 @@ jobs:
machine:
# Ubuntu 14.04 with Docker 17.10.0-ce
image: circleci/classic:201710-02
working_directory: /home/circleci/nipype
steps:
- checkout:
path: /home/circleci/nipype
- attach_workspace:
at: /tmp
- run:
name: Get test dependencies
name: Get test dependencies and generate Dockerfiles
command: |
pip install --no-cache-dir codecov
make gen-dockerfiles
- run:
name: Modify Nipype version if necessary
working_directory: /home/circleci/nipype
command: |
if [ "$CIRCLE_TAG" != "" ]; then
sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py
fi
- run:
name: Get base image (pull or build)
no_output_timeout: 60m
working_directory: /home/circleci/nipype
command: |
source /tmp/docker/get_base_image.sh
if [ "$GET_BASE" == "PULL" ]; then
Expand All @@ -72,7 +76,6 @@ jobs:
- run:
name: Build main image (py36)
no_output_timeout: 60m
working_directory: /home/circleci/nipype
command: |
e=1 && for i in {1..5}; do
docker build \
Expand All @@ -87,7 +90,6 @@ jobs:
- run:
name: Build main image (py27)
no_output_timeout: 60m
working_directory: /home/circleci/nipype
command: |
e=1 && for i in {1..5}; do
docker build \
Expand Down Expand Up @@ -151,8 +153,6 @@ jobs:
docker:
- image: docker:17.10.0-ce-git
steps:
- checkout:
path: /home/circleci/nipype
- setup_remote_docker
- attach_workspace:
at: /tmp
Expand All @@ -171,12 +171,10 @@ jobs:
docker push nipype/nipype:py36
docker push nipype/nipype:py27
- run:
name: Prune base Dockerfile to update cache
working_directory: /home/circleci/nipype/docker
name: Move pruned Dockerfile to /tmp/docker/cache directory
command: |
mkdir -p /tmp/docker/cache
# Use the sha256 sum of the pruned Dockerfile as the cache key.
ash prune_dockerfile.sh Dockerfile.base > /tmp/docker/cache/Dockerfile.base-pruned
mkdir -p /tmp/docker/cache/
mv /tmp/docker/Dockerfile.base-pruned /tmp/docker/cache/Dockerfile.base-pruned
- save_cache:
paths:
- /tmp/docker/cache/Dockerfile.base-pruned
Expand Down
233 changes: 0 additions & 233 deletions Dockerfile

This file was deleted.

Loading

0 comments on commit 28547cc

Please sign in to comment.