Skip to main content

Youtube Autonomous FastAPI Docker Base Module

The module that is handled by a docker container to isolate the environment we need for each purpose, exposed by a FastAPI that allows asking for the specific resources.

This project is using poetry to handle the dependencies and the virtual environment, and docker to manage the specific python version and all the code with the app to be executed.

Instructions

Generate the image

We need to generate the docker image with all the things we need to be able to run the app inside.

  • Use the $ docker build --no-cache -t {LIBRARY_NAME} . command to generate the Docker image by using the dockerfile file and ignoring the caché. This will download the python 3.12.x version, install the dependencies and copy the code. Use this if any dependency has changed since the last time. If you are just updating the code, you can use the following instead.
  • Use the $ docker build -t {LIBRARY_NAME} . command to generate the Docker image by using the dockerfile file. It will download the python 3.12.x version, install the dependencies and copy the code, each of these steps only if needed (the cache will make it be ignore if it didn't change).

Run the container

We need to run the container, so it will be mounted and the app will be runing and ready to use.

  • Use the command $ docker rm -f {LIBRARY_NAME} 2>nul to remove the previous container if existing, so we are able to mount it again from zero.
  • Use the command $ docker run -d -p "%port%":8000 --name {LIBRARY_NAME} {LIBRARY_NAME} to run and mount the container and make the app be ready to use.

You can also execute the run_server_docker.bat to do all together using the caché (faster).


The docker will run uvicorn in the port 8000 internally, but our navigator will redirect the 8001 to that one, so we can have different docker containers working at the same time to provide different services using the same base (uvicorn + fastapi).

Other details

  • To run the project locally, execute the run_server.bat file or use $ poetry run uvicorn yta_fastapi_docker_base.app.main:app --reload directly.

Metadata

Release files for yta-fastapi-docker-base 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yta-fastapi-docker-base 0.0.2
File Size Uploaded
yta_fastapi_docker_base-0.0.2.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yta-fastapi-docker-base 0.0.2
File Interpreter ABI Platform
yta_fastapi_docker_base-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / yta_fastapi_docker_base-0.0.2.tar.gz

Download URL yta_fastapi_docker_base-0.0.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bc02f8e9469a336c774b28692e5e18d2806370cda6d4d27711a7fa910e57b240
BLAKE2b-256 checksum
How to use checksums
ec1f461cfd9e44de750e77abad1d65e45ae925ab0afc39c76f7caa29b9b687bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.9.0 Windows/10

Release files / yta_fastapi_docker_base-0.0.2-py3-none-any.whl

Download URL yta_fastapi_docker_base-0.0.2-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cad26b1f0f4b2716d0f8176d68e3fe0d417ccf71e77579544455b17543e7f400
BLAKE2b-256 checksum
How to use checksums
b045de87363696663ff54404218355b0adecefd695d9da03f87021fbae830975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.0 CPython/3.9.0 Windows/10

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page