Update roles/build_fastapi/tasks/main.yml

This commit is contained in:
2024-01-29 12:52:50 +08:00
parent 4da6f293e8
commit bf8f9c7e04

View File

@@ -20,30 +20,3 @@
command: command:
cmd: source "{{ build_root_abspath }}/venv/bin/activate" cmd: source "{{ build_root_abspath }}/venv/bin/activate"
cmd: pip install "fastapi[all]" cmd: pip install "fastapi[all]"
- name: hello-world
community.docker.docker_image:
name: helloworld-fastapi
source: build
build:
path: "{{ build_root_abspath }}"
pull: false
tag: "{{ demobackend_version }}"
- name: run docker
community.docker.docker_image:
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 }}"