Skip to content

Commit

Permalink
fix: fix api doc and dockerfile to create requirement txt inside and …
Browse files Browse the repository at this point in the history
…removed from CI
  • Loading branch information
aminemindee committed Oct 12, 2022
1 parent ca648a7 commit eccb2ee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ jobs:
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.1.13
- name: Lock the requirements
run: |
cd api
make lock
- name: Build & run docker
run: cd api && docker-compose up -d --build
- name: Ping server
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ Looking to integrate docTR into your API? Here is a template to get you started
#### Deploy your API locally
Specific dependencies are required to run the API template, which you can install as follows:
```shell
pip install -r api/requirements.txt
cd api/
pip install poetry
make lock
pip install -r requirements.txt
```
You can now run your API locally:

Expand Down
17 changes: 7 additions & 10 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@ ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH "${PYTHONPATH}:/app"

# copy requirements file
RUN apt-get update \
&& apt-get install --no-install-recommends ffmpeg libsm6 libxext6 git make -y \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

COPY pyproject.toml /app/pyproject.toml
RUN pip install --upgrade pip \
&& pip install poetry \
&& poetry export -f requirements.txt --without-hashes --output requirements.txt
COPY requirements.txt /app/requirements.txt
COPY Makefile /app/Makefile

RUN apt-get update \
&& apt-get install --no-install-recommends ffmpeg libsm6 libxext6 -y \
&& pip install --upgrade pip setuptools wheel \
RUN pip install --upgrade pip setuptools wheel poetry \
&& make lock \
&& pip install -r /app/requirements.txt \
&& pip cache purge \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /root/.cache/pip

# copy project
Expand Down
2 changes: 1 addition & 1 deletion api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
lock:
poetry lock
poetry export -f requirements.txt --without-hashes --output requirements.txt
poetry export -f requirements.txt --without-hashes --dev --output requirements-dev.txt
poetry export -f requirements.txt --without-hashes --with dev --output requirements-dev.txt

# Run the docker
run:
Expand Down

0 comments on commit eccb2ee

Please sign in to comment.