feat: add hub runtime and extension contract
This commit is contained in:
parent
fce19f193f
commit
7e1ec03f0c
44 changed files with 3875 additions and 84 deletions
47
Containerfile
Normal file
47
Containerfile
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
FROM python:3.12-slim AS builder
|
||||
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.5.9 /uv /usr/local/bin/uv
|
||||
|
||||
ENV UV_COMPILE_BYTECODE=1 \
|
||||
UV_LINK_MODE=copy \
|
||||
UV_PROJECT_ENVIRONMENT=/opt/hub-core
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY pyproject.toml uv.lock README.md LICENSE ./
|
||||
COPY hub_core/ ./hub_core/
|
||||
|
||||
RUN uv sync --frozen --no-dev --extra runtime --no-editable
|
||||
|
||||
FROM python:3.12-slim AS runtime
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PATH="/opt/hub-core/bin:${PATH}" \
|
||||
HUB_CORE_ENV=production \
|
||||
HUB_CORE_BACKEND=memory \
|
||||
HUB_CORE_ALLOW_EPHEMERAL=0 \
|
||||
HUB_CORE_API_HOST=0.0.0.0 \
|
||||
HUB_CORE_API_PORT=8010
|
||||
|
||||
ARG VERSION=0.2.0
|
||||
ARG VCS_REF=unknown
|
||||
|
||||
LABEL org.opencontainers.image.title="hub-core" \
|
||||
org.opencontainers.image.version="${VERSION}" \
|
||||
org.opencontainers.image.revision="${VCS_REF}" \
|
||||
org.opencontainers.image.source="https://forgejo.coulomb.social/coulomb/hub-core"
|
||||
|
||||
RUN useradd --create-home --uid 10001 --shell /usr/sbin/nologin hubcore
|
||||
|
||||
COPY --from=builder /opt/hub-core /opt/hub-core
|
||||
|
||||
USER 10001:10001
|
||||
WORKDIR /home/hubcore
|
||||
|
||||
EXPOSE 8010 8011
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8010/healthz', timeout=3).read()"
|
||||
|
||||
CMD ["hub-core", "api", "--host", "0.0.0.0", "--port", "8010"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue