Add demo environment deployed from main
Assisted-by: Claude Sonnet 4.6 via Claude Code
change llztvozvlnylmnkwvlvyxwnsqsxwtzrz
commit 4fa4732e76de88d1b167f746885aab7500e6507b
author Alpha Chen <alpha@kejadlen.dev>
date
parent rktwwnkv
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 09efa51..5694ffe 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -26,3 +26,61 @@ jobs:
           bundler-cache: true
 
       - run: bundle exec rake test
+
+  build:
+    name: Build
+    needs: test
+    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read  # checkout
+      packages: write # push container image to GHCR
+    outputs:
+      image: ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}
+    steps:
+      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
+        with:
+          persist-credentials: false
+      - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
+      - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
+        with:
+          registry: ghcr.io
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      - id: short-sha
+        run: echo "sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
+      - uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
+        id: meta
+        with:
+          images: ghcr.io/${{ github.repository }}
+          tags: |
+            type=raw,value={{date 'YYYYMMDD'}}-${{ steps.short-sha.outputs.sha }}
+      - uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
+        with:
+          context: .
+          push: true
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
+          cache-from: type=gha
+          cache-to: type=gha,mode=max
+
+  deploy:
+    name: Deploy to Fly.io
+    needs: build
+    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read # checkout
+    environment: demo
+    concurrency:
+      group: fly-deploy
+      cancel-in-progress: true
+    steps:
+      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
+        with:
+          persist-credentials: false
+      - uses: superfly/flyctl-actions/setup-flyctl@63da3ecc5e2793b98a3f2519b3d75d4f4c11cec2 # master
+      - run: flyctl deploy --image "$NEEDS_BUILD_OUTPUTS_IMAGE"
+        env:
+          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
+          NEEDS_BUILD_OUTPUTS_IMAGE: ${{ needs.build.outputs.image }}
diff --git a/Dockerfile b/Dockerfile
index c24df6c..b7e7987 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,8 @@
-FROM ruby:3.3-slim AS base
+FROM ruby:4.0-slim AS base
 
+# git is required for git-sourced gem dependencies.
 RUN apt-get update && apt-get install -y --no-install-recommends \
+    git \
     libsqlite3-0 \
     && rm -rf /var/lib/apt/lists/*
 
diff --git a/fly.toml b/fly.toml
new file mode 100644
index 0000000..faf8502
--- /dev/null
+++ b/fly.toml
@@ -0,0 +1,27 @@
+# fly.toml app configuration file generated for domus-coral-raindrop-3999 on 2026-06-11T06:58:51-07:00
+#
+# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
+#
+
+app = 'domus-demo'
+primary_region = 'sjc'
+
+[build]
+  dockerfile = 'Dockerfile'
+
+[env]
+  RACK_ENV = 'production'
+
+[http_service]
+  internal_port = 9292
+  force_https = true
+  auto_stop_machines = 'stop'
+  auto_start_machines = true
+  min_machines_running = 0
+  processes = ['app']
+
+[[vm]]
+  memory = '1gb'
+  cpu_kind = 'shared'
+  cpus = 1
+  memory_mb = 256