- name: Make build artifact. hosts: localhost vars_files: ../secrets/gitea.json tasks: - name: Build image. community.docker.docker_image_build: name: "{{ image_name }}" path: ../gitea nocache: true rebuild: always pull: true - name: Make temp file. ansible.builtin.tempfile: suffix: .tar register: tar_file - name: Push image to archive. community.docker.docker_image: name: "{{ image_name }}" archive_path: "{{ tar_file.path }}" source: local - name: Compress archive to artifact. register: compress_image community.general.archive: path: "{{ tar_file.path }}" dest: "{{ tar_file.path }}.xz" format: xz mode: "0644" - name: Push artifact to S3. amazon.aws.s3_object: bucket: "{{ image_bucket }}" object: "{{ image_key }}" src: "{{ tar_file.path }}.xz" mode: put region: "{{ aws_region }}" access_key: "{{ aws_access_key }}" secret_key: "{{ aws_secret_key }}"