treetrail-backend/build.yaml

54 lines
1.4 KiB
YAML
Raw Normal View History

- name: Build containers images
2024-10-30 02:07:05 +01:00
hosts: localhost
gather_facts: false
vars:
force_rm: false
cache: false
repository: tiptop:5000
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 }}/treetrail-backend-deps"
- name: Get the version from git
command: git describe --dirty --tags
register: version
args:
chdir: "{{ playbook_dir }}"
2024-11-03 02:38:45 +01:00
- name: Build the backend container image
2024-10-30 02:07:05 +01:00
containers.podman.podman_image:
name: "treetrail-backend:{{ version.stdout }}"
2024-10-30 02:07:05 +01:00
state: build
force: true
2024-10-30 02:07:05 +01:00
path: "{{ playbook_dir }}"
build:
format: oci
force_rm: "{{ force_rm }}"
cache: "{{ cache }}"
file: Containerfile
extra_args: "--build-arg APP_VERSION={{ version.stdout }}"
2024-10-30 02:07:05 +01:00
push: true
push_args:
dest: "{{ repository }}/treetrail-backend:{{ version.stdout }}"