Container image registry

This commit is contained in:
adilallo
2026-05-23 13:30:34 -06:00
parent c663e051da
commit 2fd20d5b2a
6 changed files with 230 additions and 19 deletions
+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh
# Build, tag, and push the community-rule image to the Gitea container
# registry on git.medlab.host. See docs/guides/ops-backend-deploy.md §9.
#
# Usage:
# ./scripts/docker-release.sh # tag = git short SHA
# TAG=v0.1.1 ./scripts/docker-release.sh # explicit tag
#
# Builds for linux/amd64 explicitly so the image runs on the Cloudron host
# (x86_64) even when this script runs on an Apple Silicon laptop (aarch64).
# buildx pushes directly to the registry — no intermediate local image.
#
# Prerequisites:
# - docker login git.medlab.host (Gitea PAT with read+write:package)
# - Push permission to the CommunityRule org's packages
# - docker buildx (ships with Docker Desktop)
set -e
IMAGE="${IMAGE:-git.medlab.host/communityrule/community-rule}"
TAG="${TAG:-$(git rev-parse --short HEAD)}"
PLATFORM="${PLATFORM:-linux/amd64}"
docker buildx build \
--platform "$PLATFORM" \
--tag "$IMAGE:$TAG" \
--push \
.
echo
echo "Pushed: $IMAGE:$TAG ($PLATFORM)"
echo
echo "Next steps:"
echo " 1. Update CloudronManifest.json 'version' (must increase) and"
echo " 'dockerimage' to:"
echo " \"dockerimage\": \"$IMAGE:$TAG\""
echo " 2. First install: cloudron install"
echo " Subsequent: cloudron update --app <app-id>"
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
# Container entrypoint for Cloudron.
# Runs as root so we can chown the runtime volume mount, then drops to the
# node user (uid 1000) for the application process.
set -e
# Bridge Cloudron's env name to Prisma's expected name so `prisma migrate
# deploy` works before CR-96 lands the in-app DATABASE_URL bridging.
export DATABASE_URL="${DATABASE_URL:-$CLOUDRON_POSTGRESQL_URL}"
# /app/data is created at runtime by Cloudron's localstorage addon as
# root:root; chown so the node user can write uploads.
chown -R node:node /app/data
# Next.js ISR cache lives at /app/.next/cache via a symlink baked into the
# Dockerfile. The target on /tmp is writable on Cloudron's read-only rootfs.
mkdir -p /tmp/next-cache
chown -R node:node /tmp/next-cache
# Drop privileges, apply any pending migrations, then exec the server.
# Inner `exec` ensures SIGTERM from Cloudron reaches node for clean shutdown.
exec gosu node:node sh -c \
'./node_modules/.bin/prisma migrate deploy && exec node server.js'