{"id":19817879,"url":"https://github.com/evilwizardcreations/py-fapi-31-slim-docker-example","last_synced_at":"2026-04-12T03:32:50.787Z","repository":{"id":205743237,"uuid":"714761596","full_name":"EvilWizardCreations/py-fapi-31-slim-docker-example","owner":"EvilWizardCreations","description":"A base Python 3.10 Slim FAPI image for simulating some current production environments.","archived":false,"fork":false,"pushed_at":"2023-11-09T10:06:12.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T08:12:24.744Z","etag":null,"topics":["development","docker","docker-compose","docker-container","docker-image","dockerfile","dockerhub","dockerhub-image","fapi","python3","uvicorn"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/ewc2020/web/tags","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EvilWizardCreations.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-05T19:31:18.000Z","updated_at":"2023-11-07T10:38:03.000Z","dependencies_parsed_at":"2023-11-09T11:33:40.718Z","dependency_job_id":"890c7182-0883-4285-a8e9-971a53b196d7","html_url":"https://github.com/EvilWizardCreations/py-fapi-31-slim-docker-example","commit_stats":null,"previous_names":["evilwizardcreations/py-fapi-31-slim-docker-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fpy-fapi-31-slim-docker-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fpy-fapi-31-slim-docker-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fpy-fapi-31-slim-docker-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilWizardCreations%2Fpy-fapi-31-slim-docker-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvilWizardCreations","download_url":"https://codeload.github.com/EvilWizardCreations/py-fapi-31-slim-docker-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241174103,"owners_count":19922239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["development","docker","docker-compose","docker-container","docker-image","dockerfile","dockerhub","dockerhub-image","fapi","python3","uvicorn"],"created_at":"2024-11-12T10:14:00.053Z","updated_at":"2025-12-31T01:10:41.884Z","avatar_url":"https://github.com/EvilWizardCreations.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python 3.10 Slim FAPI Dockerfile Example\n\nA base Python 3.10 Slim FAPI image[^docker_pull_cmd_note] for basing projects available at [EWC Docker Hub](https://hub.docker.com/r/ewc2020/web).\n\n## Installed Python Dependencies\n\nThe following `pip` dependencies are already installed.\n\n- `fastapi`\n- `uvicorn`\n\n## Build \u0026 Compose Up\n\nNote that the `py-fapi-31-slim` is the Docker Compose Service to ***Build***.\n\nThere is a build script included that uses the local `.env` file \u0026 an [Evil Wizard Creations Protocol](https://bitbucket.org/evilwizardcreations/ewc-protocols) that makes this much simpler.\n\n```bash\nbuild-up-py-fapi-31-slim.sh\n```\n\nAlternatively there is the *full Procedure*.\n\n1. Build the Image using the `docker-compose-build.yaml` configuration.\n\n    ```bash\n    docker-compose -f ./docker-compose-build.yaml build --no-cache py-fapi-31-slim\n    ```\n\n1. Compose *Up* using the `docker-compose-build.yaml` configuration will use the new built Image and `-d` to *detach*.\n\n    ```bash\n    docker-compose -f ./docker-compose-build.yaml up -d\n    ```\n\n## Build Image The Long Way\n\nBuild the ***Docker Image*** without using ***cached*** versions of previous image build stages.\n\n```bash\nsudo docker build \\\n    -f py-fapi-31-slim.Dockerfile \\\n    --target build-py-fapi-31-slim \\\n    --build-arg APP_ENV=local \\\n    --no-cache \\\n    -t py-fapi-31-slim:latest \\\n    .\n```\n\n**N.B.**\n\n- Using `-f py-fapi-31-slim.Dockerfile`\n\n    To specify the *filename* to ***build*** otherwise it is expected to be named `Dockerfile`.\n\n- Using `--target build-py-fapi-31-slim`\n\n    To select the ***build target stage***[^multi_stage_builds_note] from the *Dockerfile*.\n    \n- Using `--build-arg ARG=value`\n\n    To set build argument values to use.\n\n### Create A Container\n\nThis creates a named container and attaches it to the ***host network*** and may cause port conflict if the host machine is already listening on any exposed ports from the ***Docker Image*** being used.\n\n```bash\nsudo docker run \\\n    -d \\\n    --network host \\\n    -v \"$(pwd)\"/public_html:/code/src \\\n    --name py-fapi-31-slim \\\n    py-fapi-31-slim:latest\n```\n\n**OR**\n\nThis creates a named container and attaches it to the ***bridge network*** and allows for ***port forward mapping*** from the ***host*** to the ***Container***.\n\n```bash\nsudo docker run \\\n    -d \\\n    --network bridge \\\n    -p 8080:80/tcp \\\n    -v \"$(pwd)\"/src:/code/src \\\n    --name py-fapi-31-slim \\\n    py-fapi-31-slim:latest\n```\n\n**N.B.**\n\n- Using `-v \"$(pwd)\"/src:/code/src`\n\n    To ***Volume Mount*** the folder `src` from the current folder to `/code/src` on the ***running*** container. It is where ***Python FAPI*** serves the content from \u0026 allows for *realtime* change updates.\n\n- Using `-p 8080:80/tcp` \n\n    To map port **8080** on the ***Host*** machine to port **80** on the ***Container*** using the ***bridge network***.\n\n- Using `--name py-fapi-31-slim`\n\n    To name the ***Container*** being created.\n\n### Start Container\n\n```bash\nsudo docker start py-fapi-31-slim\n```\n\n### Stop Container\n\n```bash\nsudo docker stop py-fapi-31-slim\n```\n\n## Connect To Container\n\n```bash\nsudo docker exec -it py-fapi-31-slim /bin/bash\n```\n\n# Disclaimer\n\nThis Image is intended for ***Development*** purpose only \u0026 to use as a learning aid. ***DO NOT*** use this anywhere near a ***Production*** environment.\n\n[^docker_pull_cmd_note]: Use `docker pull ewc2020/web:py-fapi-3.10-slim-latest` to get a copy of the image.\n\n[^multi_stage_builds_note]: Used mostly in ***Multi Stage*** image builds.\n\n[^compose_name_note]: The `py-fapi-31-slim` container name to build the image for.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilwizardcreations%2Fpy-fapi-31-slim-docker-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilwizardcreations%2Fpy-fapi-31-slim-docker-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilwizardcreations%2Fpy-fapi-31-slim-docker-example/lists"}