Skip to content

Commit

Permalink
chore: Updated API requirements for security (#303)
Browse files Browse the repository at this point in the history
* chore: Updated API requirements

* chore: Updated API docker orchestration
  • Loading branch information
fg-mindee committed Jun 11, 2021
1 parent fe44efb commit 820634b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
17 changes: 7 additions & 10 deletions Dockerfile-api
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
FROM python:3.8.1-slim
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim

# set work directory
WORKDIR /usr/src/app
WORKDIR /app

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH "${PYTHONPATH}:/app"

# copy requirements file
COPY api/requirements.txt /usr/src/app/api-requirements.txt
COPY api/requirements.txt /app/api-requirements.txt
COPY ./requirements.txt /tmp/requirements.txt

# install dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends ffmpeg libsm6 libxext6 -y \
&& pip install --upgrade pip setuptools wheel \
&& pip install -r /usr/src/app/api-requirements.txt \
&& pip install -r /app/api-requirements.txt \
&& pip install -r /tmp/requirements.txt \
&& pip cache purge \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /root/.cache/pip

# copy project
COPY api/ /usr/src/app/


# install doctr
COPY ./README.md /tmp/README.md
COPY ./setup.py /tmp/setup.py
Expand All @@ -35,3 +29,6 @@ COPY ./doctr /tmp/doctr
RUN pip install -e /tmp/. \
&& pip cache purge \
&& rm -rf /root/.cache/pip

# copy project
COPY api /app
2 changes: 1 addition & 1 deletion api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fastapi==0.61.1
fastapi>=0.65.2
uvicorn>=0.11.1
python-multipart==0.0.5
doctr>=0.1.1
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ services:
build:
context: .
dockerfile: Dockerfile-api
command: uvicorn app.main:app --reload --workers 1 --host 0.0.0.0 --port 8000
command: uvicorn app.main:app --reload --workers 1 --host 0.0.0.0 --port 8080
volumes:
- ./api/:/usr/src/app/
ports:
- ${PORT}:8000
- ${PORT}:8080

0 comments on commit 820634b

Please sign in to comment.