WIP: separate slurm base and docker images

This commit is contained in:
2021-06-17 22:50:23 +02:00
parent 6eb6984d6a
commit 4450c9bb65
7 changed files with 143 additions and 67 deletions

View File

@@ -0,0 +1,47 @@
- copy:
src: "{{image.name}}.Dockerfile"
dest: "/container/docker-images/slurm/{{image.name}}.Dockerfile"
owner: "{{unpriv_user}}"
group: docker
register: slurm_cp_dockerfile
# TODO: single source of truth:
# dockerfile -> parse for startup files or startup files template in dockerfile
- name: copy startup scripts
copy:
contents: "{{ item.content | default(lookup('file', item.name)) }}"
dest: "/container/docker-images/slurm/start-scripts/{{item.name}}"
owner: root
group: root
mode: u=rwx,g=rx,o=rx
loop: "{{ start_scripts | default([]) }}"
register: slurm_cp_stscrs
- set_fact:
slurm_stscrs_changed: "{{ (slurm_stscrs_changed | default([])) +
(slurm_cp_stscrs.results | selectattr('changed') |
map(attribute='item.name') | list) }}"
- set_fact:
slurm_stscrs_relevant: "{{ slurm_stscrs_changed |
intersect(start_scripts | default([]) | map(attribute='name') | list) |
length > 0 }}"
- debug: msg="{{slurm_cp_dockerfile.changed or
slurm_stscrs_relevant or
slurm_baseimg_build_chg }}"
- docker_image:
name: "slurm"
tag: "{{image.name}}"
# pull: False
build:
pull: False
path: "/container/docker-images/slurm/"
dockerfile: "{{image.name}}.Dockerfile"
# target: "{{image.name}}" # unsupported on old docker-py version as in el7
source: build
force_source: "{{slurm_cp_dockerfile.changed or
slurm_stscrs_relevant or
slurm_baseimg_build_chg }}"
# TODO: force when base image changed!