Skip to content

Commit

Permalink
Move uwsgi to poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
farioas committed Nov 14, 2024
1 parent 9e97d55 commit da91ced
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 31 deletions.
13 changes: 2 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
ARG NODE_VERSION=18
ARG PYTHON_VERSION=3.12
ARG POETRY_VERSION=1.8.4
ARG UWSGI_VERSION=2.0.28
ARG UWSGITOP_VERSION=0.12

################################ Overview

Expand Down Expand Up @@ -53,9 +51,6 @@ RUN --mount=type=cache,target=${YARN_CACHE_FOLDER},sharing=locked \
################################ Stage: venv-builder (prepare the virtualenv)
FROM python:${PYTHON_VERSION}-slim AS venv-builder
ARG POETRY_VERSION
ARG PYTHON_VERSION
ARG UWSGI_VERSION
ARG UWSGITOP_VERSION

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
Expand Down Expand Up @@ -86,21 +81,17 @@ ENV PATH="$VENV_PATH/bin:$PATH"

## Starting from this line all packages will be installed in $VENV_PATH

# Install middleware components
RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \
pip install uwsgi==${UWSGI_VERSION} uwsgitop==${UWSGITOP_VERSION}

# Copy dependency files
COPY pyproject.toml poetry.lock README.md ./

# Install dependencies without dev packages
RUN --mount=type=cache,target=$POETRY_CACHE_DIR,sharing=locked \
poetry check --lock && poetry install --no-root --without test
poetry check --lock && poetry install --no-root --without test --extras "uwsgi"

# Install LS
COPY label_studio label_studio
RUN --mount=type=cache,target=$POETRY_CACHE_DIR,sharing=locked \
poetry install --only-root && \
poetry install --only-root --extras "uwsgi" && \
python3 label_studio/manage.py collectstatic --no-input

################################### Stage: prod
Expand Down
95 changes: 77 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ launchdarkly-server-sdk = "8.2.1"
python-json-logger = "2.0.4"
google-cloud-storage = "^2.13.0"
google-cloud-logging = "^3.10.0"
mysqlclient = {version = "*", optional = true}
pyuwsgi = { version = "2.0.28.post1", optional = true }
uwsgitop = { version = "0.12", optional = true }
django-csp = "3.7"
openai = "^1.10.0"
django-migration-linter = "^5.1.0"
Expand Down Expand Up @@ -225,7 +226,7 @@ requests-mock = "1.12.1"
twine = ">=4.0.2"

[tool.poetry.extras]
mysql = ["mysqlclient"]
uwsgi = ["pyuwsgi","uwsgitop"]

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit da91ced

Please sign in to comment.