add root option for poetry to Dockerfile (#10)

This commit is contained in:
Dmitry Afanasyev 2023-09-26 06:14:25 +03:00 committed by GitHub
parent 38932d0ba9
commit e8ace80d68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -37,6 +37,7 @@ jobs:
curl -sSL "https://install.python-poetry.org" | python -
# Adding `poetry` to `$PATH`:
echo "$HOME/.local/bin" >> $GITHUB_PATH
apt-get update && apt-get install --no-install-recommends -y ffmpeg
- name: Set up cache
uses: actions/cache@v3
@ -59,7 +60,7 @@ jobs:
run: |
poetry config virtualenvs.in-project true
poetry install
poetry run pip install -U pip ffmpeg
poetry run pip install -U pip
#----------------------------------------------
# run test suite
#----------------------------------------------

View File

@ -64,10 +64,16 @@ gunicorn main:create_app --workers 10 --bind 0.0.0.0:8083 --worker-class uvicorn
## Tests
### Run local tests:
```bash
poetry run pytest
```
### Run tests in docker compose:
```bash
docker compose run bot poetry run pytest bot_microservice/
```
## Docs
Docs can be found at

View File

@ -21,6 +21,7 @@ RUN printf "================ Start build base service. with USER: ${USER} ======
curl \
git \
nano \
ffmpeg \
# Cleaning cache:
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
@ -35,10 +36,10 @@ RUN if [ "$USER" != "root" ]; then \
COPY --chown=${USER}:${USER} ../poetry.lock ../pyproject.toml /app/
RUN pip install --upgrade pip && pip install poetry==$POETRY_VERSION && pip install ffmpeg
RUN pip install --upgrade pip && pip install poetry==$POETRY_VERSION
RUN poetry config virtualenvs.in-project true && \
poetry config virtualenvs.create true && \
poetry install --only main --no-interaction --no-ansi && \
poetry install $(if [ "$USER" != "root" ]; then echo "--only main"; fi) --no-interaction --no-ansi && \
rm -rf $POETRY_CACHE_DIR