-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
598ccc8
commit fe4a000
Showing
9 changed files
with
62 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"containers": [ | ||
"de41975f4f64", | ||
"074add429712" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
# For more information, please refer to https://aka.ms/vscode-docker-python | ||
FROM python:3.10-slim | ||
|
||
EXPOSE 8000 | ||
|
||
# Keeps Python from generating .pyc files in the container | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
WORKDIR /app | ||
|
||
# Turns off buffering for easier container logging | ||
ENV PYTHONUNBUFFERED=1 | ||
ENV PORT 8080 | ||
ENV HOST 0.0.0.0 | ||
|
||
# Install pip requirements | ||
COPY requirements.txt . | ||
RUN python -m pip install -r requirements.txt | ||
|
||
WORKDIR /app | ||
COPY . /app | ||
#copy local code to the container | ||
COPY . . | ||
|
||
EXPOSE 8080 | ||
|
||
# Creates a non-root user with an explicit UID and adds permission to access the /app folder | ||
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers | ||
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app | ||
USER appuser | ||
# For more info, please refer to https://aka.ms/vdockerscode-docker-python-configure-containers | ||
#RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app | ||
#USER appuser | ||
|
||
#EXPOSE 8080 | ||
|
||
# Keeps Python from generating .pyc files in the container 074add429712 | ||
# ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Turns off buffering for easier container logging | ||
# ENV PYTHONUNBUFFERED=1 | ||
|
||
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug | ||
#CMD ["gunicorn", "--bind", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "main:app"] | ||
#CMD ["gunicorn", "--bind", "0.0.0.0:8080", "-k", "uvicorn.workers.UvicornWorker", "main:app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: "3.4" | ||
|
||
services: | ||
apis: | ||
image: apis | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
command: | ||
[ | ||
"sh", | ||
"-c", | ||
"pip install debugpy -t /tmp && python /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 -m uvicorn main:app --host 0.0.0.0 --port 8080", | ||
] | ||
ports: | ||
- 8080:8080 | ||
- 5678:5678 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
from fastapi import FastAPI | ||
"""Module providing env""" | ||
from os import environ as env | ||
|
||
from fastapi import FastAPI | ||
|
||
app = FastAPI() | ||
|
||
|
||
@app.get("/") | ||
def index(): | ||
"""_summary_ | ||
Returns: | ||
_type_: _description_ | ||
""" | ||
return {"details": f"Hello World! Secret = {env['MY_VARIABLE']}"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters