Update roles/build_fastapi/tasks/main.yml

This commit is contained in:
2024-02-01 11:58:35 +08:00
parent 30ef453225
commit f58937af76

View File

@@ -27,4 +27,24 @@
build: build:
path: "{{ build_root_abspath }}" path: "{{ build_root_abspath }}"
pull: false pull: false
tag: "{{ demobackend_version }}" tag: "{{ demobackend_version }}"
- name: run docker
community.docker.docker_container:
name: demobackend
state: started
recreate: yes
image: "helloworld-fastapi:{{ demobackend_version }}"
ports:
- "8080:8080"
- name: wait for the api ready
wait_for:
host: 0.0.0.0
port: 8080
delay: 10
- name: testing api locally
shell: "curl -k localhost:8080"
register: reg_curl_result
- name: show curl result
debug:
msg: "{{ reg_curl_result.stdout }}"