54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
- name: Build containers images
|
|
hosts: localhost
|
|
gather_facts: false
|
|
vars:
|
|
force_rm: false
|
|
cache: false
|
|
repository: code.philo.ydns.eu
|
|
organisation: philorg
|
|
|
|
tasks:
|
|
#- name: Read conf
|
|
# ansible.builtin.include_vars:
|
|
# file: prod.yaml
|
|
# name: conf
|
|
|
|
- name: Using the variables
|
|
ansible.builtin.debug:
|
|
var: force_rm
|
|
|
|
- name: Build the base image, only with python dependencies
|
|
containers.podman.podman_image:
|
|
name: treetrail-backend-deps
|
|
state: build
|
|
path: "{{ playbook_dir }}"
|
|
build:
|
|
format: oci
|
|
force_rm: "{{ force_rm }}"
|
|
cache: "{{ cache }}"
|
|
file: Containerfile.deps
|
|
push: true
|
|
push_args:
|
|
dest: "{{ repository }}/{{ organisation }}/treetrail-backend-deps"
|
|
|
|
- name: Get the version from git
|
|
command: git describe --dirty --tags
|
|
register: version
|
|
args:
|
|
chdir: "{{ playbook_dir }}"
|
|
|
|
- name: Build the backend container image
|
|
containers.podman.podman_image:
|
|
name: "treetrail-backend:{{ version.stdout }}"
|
|
state: build
|
|
force: true
|
|
path: "{{ playbook_dir }}"
|
|
build:
|
|
format: oci
|
|
force_rm: "{{ force_rm }}"
|
|
cache: "{{ cache }}"
|
|
file: Containerfile
|
|
extra_args: "--build-arg APP_VERSION={{ version.stdout }}"
|
|
push: true
|
|
push_args:
|
|
dest: "{{ repository }}/{{ organisation }}/treetrail-backend:{{ version.stdout }}"
|