2024-11-04 03:58:58 +01:00
|
|
|
- name: Build containers images
|
2024-10-30 02:07:05 +01:00
|
|
|
hosts: localhost
|
|
|
|
gather_facts: false
|
|
|
|
vars:
|
|
|
|
force_rm: false
|
|
|
|
cache: false
|
2024-12-06 03:16:21 +01:00
|
|
|
repository: code.philo.ydns.eu
|
|
|
|
organisation: philorg
|
2024-10-30 02:07:05 +01:00
|
|
|
|
|
|
|
tasks:
|
|
|
|
#- name: Read conf
|
|
|
|
# ansible.builtin.include_vars:
|
|
|
|
# file: prod.yaml
|
|
|
|
# name: conf
|
|
|
|
|
2024-12-06 05:03:55 +01:00
|
|
|
- name: Build the database image
|
|
|
|
tags: db
|
|
|
|
containers.podman.podman_image:
|
|
|
|
name: treetrail-database
|
|
|
|
state: build
|
|
|
|
path: "{{ playbook_dir }}"
|
|
|
|
build:
|
|
|
|
format: oci
|
|
|
|
force_rm: "{{ force_rm }}"
|
|
|
|
cache: "{{ cache }}"
|
|
|
|
file: Containerfile.database
|
|
|
|
push: true
|
|
|
|
push_args:
|
|
|
|
dest: "{{ repository }}/{{ organisation }}"
|
|
|
|
|
2024-10-30 02:07:05 +01:00
|
|
|
- name: Using the variables
|
|
|
|
ansible.builtin.debug:
|
|
|
|
var: force_rm
|
|
|
|
|
2024-12-06 03:34:01 +01:00
|
|
|
- name: Get the version from git
|
2024-12-06 05:03:55 +01:00
|
|
|
tags:
|
|
|
|
- ci
|
|
|
|
- deps
|
|
|
|
- backend
|
2024-12-06 03:34:01 +01:00
|
|
|
command: git describe --dirty --tags
|
|
|
|
register: version
|
|
|
|
args:
|
|
|
|
chdir: "{{ playbook_dir }}"
|
|
|
|
|
|
|
|
- name: Build the base CI image
|
2024-12-06 05:03:55 +01:00
|
|
|
tags: ci
|
2024-12-06 03:34:01 +01:00
|
|
|
containers.podman.podman_image:
|
|
|
|
name: treetrail-backend-ci
|
2024-12-06 03:35:08 +01:00
|
|
|
tag: "{{ version.stdout }}"
|
2024-12-06 03:34:01 +01:00
|
|
|
state: build
|
|
|
|
path: "{{ playbook_dir }}"
|
|
|
|
build:
|
|
|
|
format: oci
|
|
|
|
force_rm: "{{ force_rm }}"
|
|
|
|
cache: "{{ cache }}"
|
|
|
|
file: Containerfile.ci
|
|
|
|
push: true
|
|
|
|
push_args:
|
2024-12-06 05:03:55 +01:00
|
|
|
dest: "{{ repository }}/{{ organisation }}"
|
2024-12-06 03:34:01 +01:00
|
|
|
|
2024-10-30 02:07:05 +01:00
|
|
|
- name: Build the base image, only with python dependencies
|
2024-12-06 05:03:55 +01:00
|
|
|
tags: deps
|
2024-10-30 02:07:05 +01:00
|
|
|
containers.podman.podman_image:
|
|
|
|
name: treetrail-backend-deps
|
2024-12-06 03:35:08 +01:00
|
|
|
tag: "{{ version.stdout }}"
|
2024-10-30 02:07:05 +01:00
|
|
|
state: build
|
|
|
|
path: "{{ playbook_dir }}"
|
|
|
|
build:
|
|
|
|
format: oci
|
|
|
|
force_rm: "{{ force_rm }}"
|
|
|
|
cache: "{{ cache }}"
|
|
|
|
file: Containerfile.deps
|
|
|
|
push: true
|
|
|
|
push_args:
|
2024-12-06 03:34:01 +01:00
|
|
|
dest: "{{ repository }}/{{ organisation }}"
|
2024-11-04 03:58:58 +01:00
|
|
|
|
2024-11-03 02:38:45 +01:00
|
|
|
- name: Build the backend container image
|
2024-12-06 05:03:55 +01:00
|
|
|
tags: backend
|
2024-10-30 02:07:05 +01:00
|
|
|
containers.podman.podman_image:
|
2024-12-06 03:34:01 +01:00
|
|
|
name: treetrail-backend
|
|
|
|
tag: "{{ version.stdout }}"
|
2024-10-30 02:07:05 +01:00
|
|
|
state: build
|
2024-11-01 05:32:40 +01:00
|
|
|
force: true
|
2024-10-30 02:07:05 +01:00
|
|
|
path: "{{ playbook_dir }}"
|
|
|
|
build:
|
|
|
|
format: oci
|
|
|
|
force_rm: "{{ force_rm }}"
|
|
|
|
cache: "{{ cache }}"
|
|
|
|
file: Containerfile
|
2024-11-04 03:58:58 +01:00
|
|
|
extra_args: "--build-arg APP_VERSION={{ version.stdout }}"
|
2024-10-30 02:07:05 +01:00
|
|
|
push: true
|
|
|
|
push_args:
|
2024-12-06 03:34:01 +01:00
|
|
|
dest: "{{ repository }}/{{ organisation }}"
|