treetrail-backend/build.yaml
phil 1693662e75
All checks were successful
/ test (push) Successful in 17s
/ build (push) Successful in 19s
Version file added dynamically (workaround as uv does not have this feature yet)
Tag container image with playbook
Importable module with python -m treetrail
2024-11-04 03:58:58 +01:00

53 lines
1.4 KiB
YAML

- name: Build containers images
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 }}"
- 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 }}/treetrail-backend:{{ version.stdout }}"