Verified Commit 5c6667e4 authored by hanke's avatar hanke Committed by Jakob Moser
Browse files

Migrate to uv instead of Pipenv

parent f7031901
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
FROM python:3.12 AS base
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# We will use /app as our main directory within the Docker container
WORKDIR /app
@@ -9,14 +10,10 @@ ARG USERNAME="portaluser"
# First, copy and install only the requirements...
RUN useradd -ms /bin/bash ${USERNAME} && chown -R ${USERNAME}:${USERNAME} /app
USER ${USERNAME}
# The modified PATH is needed so that the pipenv executaable is found.
ENV PATH="$PATH:/home/${USERNAME}/.local/bin"
RUN pip install --upgrade pip setuptools
RUN pip install pipenv
COPY Pipfile.lock .
RUN pipenv requirements > requirements.txt
RUN pip uninstall --yes pipenv
RUN pip install -r requirements.txt
COPY pyproject.toml .
COPY uv.lock .
RUN uv sync --locked

# ... then the rest of the application. This allows the installation stage to be cached most of the time
# (so we don't have reinstall of all dependencies every time the container is rebuilt)
COPY --chown=${USERNAME}:${USERNAME} . .
+3 −3
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
if [ -z $SKIP_ALEMBIC_MIGRATIONS ]
then
  # Run alembic migrations, unless SKIP_ALEMBIC_MIGRATIONS is set
  alembic upgrade head
  uv run alembic upgrade head
fi

# We expose the application to every interface (0.0.0.0) within the container.
@@ -14,9 +14,9 @@ fi

case ${SERVER_TYPE} in
  "flask")
    flask run --host 0.0.0.0;;
    uv run flask run --host 0.0.0.0;;
  "uwsgi")
    uwsgi --http 0.0.0.0:5000 --enable-threads -w "portal:create_app()";;
    uv run uwsgi -H .venv --http 0.0.0.0:5000 --enable-threads -w "portal:create_app()";;
  *)
    exit 1;;
esac
+33 −0
Original line number Diff line number Diff line
[project]
name = "fscoli-portal"
version = "0.0.1"
description = "A service-aggregating meta-service for FS Coli"
authors = [{ name = "FS Coli", email = "fachschaft@cl.uni-heidelberg.de" }]
requires-python = ">=3.11"
readme = "README.md"
license = { text = "MIT" }
dependencies = [
    "alembic",
    "argon2-cffi",
    "flask-sqlalchemy",
    "flask",
    "ldap3",
    "requests",
    "sqlalchemy",
]

[dependency-groups]
dev = [
    "black",
    "mypy",
    "types-requests",
    "types-ldap3",
]

[tool.uv]
package = false

[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple"

[tool.mypy]
disallow_untyped_calls = true
disallow_untyped_defs = true

uv.lock

0 → 100644
+484 −0

File added.

Preview size limit exceeded, changes collapsed.