basic ping route
parent
b75e72eca0
commit
e22de825d4
@ -0,0 +1,10 @@
|
|||||||
|
version: '3.7'
|
||||||
|
|
||||||
|
services:
|
||||||
|
api:
|
||||||
|
build: ./services/api
|
||||||
|
command: uvicorn app.main:app --reload --workers 1 --host 0.0.0.0 --port 8000
|
||||||
|
volumes:
|
||||||
|
- ./services/api/:/opt/fast_api/
|
||||||
|
ports:
|
||||||
|
- 8002:8000
|
@ -0,0 +1,23 @@
|
|||||||
|
# pull official base image
|
||||||
|
FROM python:3.8.1-alpine
|
||||||
|
|
||||||
|
# set work directory
|
||||||
|
WORKDIR /opt/fast_api
|
||||||
|
|
||||||
|
# set environment variables
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE 1
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
|
# copy requirements file
|
||||||
|
COPY ./requirements.txt /opt/fast_api/requirements.txt
|
||||||
|
|
||||||
|
# install dependencies
|
||||||
|
RUN set -eux \
|
||||||
|
&& apk add --no-cache --virtual .build-deps build-base \
|
||||||
|
libressl-dev libffi-dev gcc musl-dev python3-dev postgresql-dev \
|
||||||
|
&& pip install --upgrade pip setuptools wheel \
|
||||||
|
&& pip install -r /opt/fast_api/requirements.txt \
|
||||||
|
&& rm -rf /root/.cache/pip
|
||||||
|
|
||||||
|
# copy project
|
||||||
|
COPY . /opt/fast_api/
|
@ -0,0 +1,8 @@
|
|||||||
|
from fastapi import FastAPI
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
|
||||||
|
@app.get('/ping')
|
||||||
|
def pong():
|
||||||
|
return {"ping": "pong!"}
|
Loading…
Reference in New Issue