From b13018a7d62471862e3b746bd2d9857215c85dcd Mon Sep 17 00:00:00 2001 From: Shahriyar Rzayev Date: Tue, 16 Feb 2021 21:00:21 +0400 Subject: [PATCH 1/2] [Enhancement] added Dockerfile, docker-compose.yaml and the README.md file --- Dockerfile | 7 +++++++ README.md | 22 ++++++++++++++++++++++ docker-compose.yaml | 11 +++++++++++ 3 files changed, 40 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8b633cb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.8 +WORKDIR /app +COPY requirements.txt ./ +RUN pip3 install --no-cache-dir -r requirements.txt +COPY . . + +CMD ["uvicorn", "main:app", "--reload"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a05d016 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# This repo is for [Youtube FastAPI 4 hours full course](https://www.youtube.com/watch?v=7t2alSnE2-I) + +## Created by [Sarthak](https://twitter.com/Sarthaksavvy) + +### The Docker usage is simply based on docker-compose: + +*To build the container* + +``` +docker-compose -f docker-compose.yaml up --build +``` + +*To login to the container* + +``` +docker-compose -f docker-compose.yaml exec /bin/bash +``` + +It should be ready now. + +> Note: if you updated/edited the code just run the build command again to get the new changes. + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..0ce58fc --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +version: "3.7" + +services: + api_v1: + build: + context: . + dockerfile: Dockerfile + container_name: fastapi_bitfumes_full_course_v1 + ports: + - "8000:8000" + network_mode: host \ No newline at end of file From 7d48251c80a59ae791c36543c9622271d33a812f Mon Sep 17 00:00:00 2001 From: Shahriyar Rzayev Date: Tue, 16 Feb 2021 21:10:15 +0400 Subject: [PATCH 2/2] [Enhancement] updated the README.md file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a05d016..08241fc 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,14 @@ ``` docker-compose -f docker-compose.yaml up --build ``` +It should be up now. -*To login to the container* +*To login to the container(if you want)* ``` docker-compose -f docker-compose.yaml exec /bin/bash ``` -It should be ready now. > Note: if you updated/edited the code just run the build command again to get the new changes.