Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 signup: the person chooses the password and name on the confirm page 83c7aa6 2 weeks, 5 days ago History
Dockerfile · 2.8 KB · 61 lines
1# DBBASIC Object Server — container image.
2#
3# This is a second deployment path alongside the bare-VM systemd installer
4# (scripts/install.sh, docs/single-vm-deployment.md). See
5# docs/docker-deployment.md for the full story, especially what ships baked
6# into this image versus what must live on a mounted volume.
7FROM python:3.12-slim
8
9# curl is added deliberately, only so the HEALTHCHECK below can make a plain
10# HTTP call to /health without pulling in a Python HTTP client at build time.
11RUN apt-get update \
12 && apt-get install -y --no-install-recommends curl \
13 && rm -rf /var/lib/apt/lists/*
14
15# Non-root service user, mirroring the `dbbasic` service user that
16# scripts/install.sh creates for the bare-VM systemd unit -- the process
17# does not run as root in the container either.
18RUN useradd --system --create-home --home-dir /home/dbbasic --shell /usr/sbin/nologin dbbasic
19
20WORKDIR /opt/dbbasic-object-server
21
22# Install the runtime dependencies (the `server` extra) in their own layer,
23# before the source is copied, so ordinary code changes do not re-download
24# them on every rebuild. Keep these pins in sync with pyproject.toml's
25# [project.optional-dependencies] server list.
26RUN python -m pip install --no-cache-dir --upgrade pip \
27 && python -m pip install --no-cache-dir "uvicorn>=0.30.0" "websockets>=12.0"
28
29COPY . .
30# .dockerignore keeps git history, tests, docs, caches, and any local
31# data/objects/ runtime state out of this layer -- see its comments.
32RUN python -m pip install --no-cache-dir -e ".[server]" \
33 && chmod +x scripts/docker-entrypoint.sh
34
35# Persistent state lives outside the checkout, the same separation
36# docs/single-vm-deployment.md keeps between /opt (code) and /var/lib (data).
37# These are the paths an operator mounts as volumes; see docker-compose.yml.
38ENV DBBASIC_OBJECTS_DIR=/data/objects \
39 DBBASIC_DATA_DIR=/data/state \
40 DBBASIC_PACKAGES_DIR=/opt/dbbasic-object-server/packages
41
42# Pre-create the mount points and own them as the service user. When Docker
43# mounts an empty named volume over one of these paths, it copies this
44# layer's ownership into the new volume on first run, so the app never has
45# to write into a root-owned directory.
46RUN mkdir -p /data/objects /data/state \
47 && chown -R dbbasic:dbbasic /data /opt/dbbasic-object-server
48
49USER dbbasic
50
51EXPOSE 8001
52
53HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
54 CMD curl -fsS http://127.0.0.1:8001/health || exit 1
55
56ENTRYPOINT ["scripts/docker-entrypoint.sh"]
57# Bind 0.0.0.0, unlike the bare-VM unit's 127.0.0.1 -- there, Caddy runs on
58# the same host and reaches uvicorn over loopback; here, the container's own
59# network namespace means Docker's port mapping / Coolify's proxy need
60# 0.0.0.0 to reach this process at all.
61CMD ["uvicorn", "object_server:app", "--host", "0.0.0.0", "--port", "8001"]