moved poetry install to pip

This commit is contained in:
Alexander Karpov 2023-08-30 11:55:35 +03:00
parent 6c1da495db
commit 49ffd7317b
3 changed files with 18 additions and 16 deletions

View File

@ -19,6 +19,7 @@ ENV PYTHONUNBUFFERED 1
ENV DRAWIO_VERSION 15.7.3 ENV DRAWIO_VERSION 15.7.3
ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONDONTWRITEBYTECODE 1
ENV BUILD_ENV ${BUILD_ENVIRONMENT} ENV BUILD_ENV ${BUILD_ENVIRONMENT}
ENV POETRY_VERSION 1.4.2
WORKDIR ${APP_HOME} WORKDIR ${APP_HOME}
@ -30,16 +31,15 @@ RUN apt-get update && \
apt-get purge -y --auto-remove -o APT:AutoRemove:RecommendsImportant=false && \ apt-get purge -y --auto-remove -o APT:AutoRemove:RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
RUN curl -sSL https://install.python-poetry.org | python3 - RUN pip install "poetry==$POETRY_VERSION"
# Dependencies for file preview generation RUN python -m venv /venv
# RUN curl -LO https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-x86_64-${DRAWIO_VERSION}.AppImage && mv drawio-x86_64-${DRAWIO_VERSION}.AppImage /usr/local/bin/drawio
ENV PATH="/root/.local/bin:$PATH"
RUN poetry config virtualenvs.create false COPY pyproject.toml poetry.lock /app/
RUN poetry export -f requirements.txt | /venv/bin/pip install -r /dev/stdin
COPY . .
RUN poetry build && /venv/bin/pip install dist/*.whl
COPY ./pyproject.toml ./poetry.lock /app/
RUN poetry install --no-root --only main
RUN preview --check-dependencies
COPY ./compose/production/django/entrypoint /entrypoint COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint RUN sed -i 's/\r$//g' /entrypoint

View File

@ -44,14 +44,14 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN pip install poetry RUN pip install "poetry==$POETRY_VERSION"
RUN python -m venv /venv
# Configuring poetry COPY pyproject.toml poetry.lock /app/
RUN poetry config virtualenvs.create false RUN poetry export -f requirements.txt | /venv/bin/pip install -r /dev/stdin
COPY pyproject.toml poetry.lock /
# Installing requirements COPY . .
RUN poetry install RUN poetry build && /venv/bin/pip install dist/*.whl
COPY --chown=django:django ./compose/production/django/entrypoint /entrypoint COPY --chown=django:django ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint RUN sed -i 's/\r$//g' /entrypoint

View File

@ -1,9 +1,11 @@
#!/bin/bash #!/bin/sh
set -e
set -o errexit set -o errexit
set -o pipefail
set -o nounset set -o nounset
. /venv/bin/activate
# N.B. If only .env files supported variable expansion... # N.B. If only .env files supported variable expansion...