Skip to content

Commit

Permalink
build: re-create the builder docker image when Dockerfile changes
Browse files Browse the repository at this point in the history
It takes longer but works all the time. Uploading an image to a docker
repository to speed-up the build requires an additional manual step
and access to the docker repository.

A possible optimization (would be a few minutes faster) could be
implemented by storing docker layers, similar to what is done for the
Dockerfile used when testing.
  • Loading branch information
Loic Dachary committed Feb 23, 2018
1 parent f08b578 commit e598c92
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion molecule/builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ubuntu:14.04
# ubuntu:14.04 as of 2017-12-15
FROM ubuntu@sha256:084989eb923bd86dbf7e706d464cf3587274a826b484f75b69468c19f8ae354c

RUN apt-get -y update && apt-get install -y python rsync sudo bash \
devscripts git aptitude ipython libssl-dev ntp \
Expand Down
8 changes: 6 additions & 2 deletions molecule/builder/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
molecule_ephemeral_directory: "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}"
molecule_scenario_directory: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}"
molecule_yml: "{{ lookup('file', molecule_file) | from_yaml }}"
docker_hash: "{{ lookup('file', '../docker_hashes.yml') | from_yaml }}"
tasks:
- name: Create builder image
docker_image:
name: builder
path: .
force: yes
- name: Create molecule instance(s)
docker_container:
name: "{{ item.name }}"
hostname: "{{ item.name }}"
image: "{{ item.image }}@{{ docker_hash[item.hash_name] }}"
image: builder
state: started
recreate: True
command: "tail -f /dev/null"
Expand Down
2 changes: 0 additions & 2 deletions molecule/builder/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ lint:
name: yamllint
platforms:
- name: build
image: quay.io/freedomofpress/ubuntu:trusty
hash_name: ubuntu
groups:
- build
provisioner:
Expand Down
2 changes: 0 additions & 2 deletions molecule/docker_hashes.yml

This file was deleted.

0 comments on commit e598c92

Please sign in to comment.