From 86476115df9320a5d57f3401dcaff0dba3d118a5 Mon Sep 17 00:00:00 2001 From: "khalid@traclabs.com" Date: Wed, 22 Apr 2026 23:52:29 -0500 Subject: [PATCH] Fix content and URL in README --- Dockerfile | 4 ++++ README.md | 4 ++-- server/Dockerfile | 11 +++++++++++ server/entrypoint.sh | 19 +++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 server/entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 1d8dfde..1ed4ef0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,10 +24,14 @@ COPY --from=base /app/dist ./dist COPY --from=base /app/package.json ./ COPY --from=base /app/site-context.json ./ COPY --from=base /app/content ./content +COPY --from=base /app/content ./content-seed COPY --from=base /app/config ./config +COPY --from=base /app/server/entrypoint.sh /app/entrypoint.sh +RUN chmod +x /app/entrypoint.sh ENV HOST=0.0.0.0 ENV PORT=4321 EXPOSE 4321 +ENTRYPOINT ["/app/entrypoint.sh"] CMD ["node", "dist/server/entry.mjs"] diff --git a/README.md b/README.md index 94ba201..63fa23d 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,8 @@ See `.env.example` for all options. ### Vonage Setup 1. Create a Vonage application in the Dashboard with Messages capability enabled. -2. Set the inbound message webhook URL to `https://dynamicsites.kadil.dev/webhooks/inbound` (POST). -3. Set the status webhook URL to `https://dynamicsites.kadil.dev/webhooks/status` (POST). +2. Set the inbound message webhook URL to `https://smsapi.kadil.dev/webhooks/inbound` (POST). +3. Set the status webhook URL to `https://smsapi.kadil.dev/webhooks/status` (POST). 4. Under API Settings, ensure Messages API is set as the default for SMS. 5. Copy the generated `private.key` to the project root. 6. Note your signature secret from Dashboard → API Settings for webhook verification. diff --git a/server/Dockerfile b/server/Dockerfile index 5f00c36..8e67b4c 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -15,13 +15,24 @@ RUN npm rebuild better-sqlite3 COPY shared ./shared COPY server ./server COPY site-context.json ./ + +# Copy content twice: +# /app/content — the live directory (will be overlaid by a volume mount) +# /app/content-seed — preserved in the image, used to seed empty volumes COPY content ./content +COPY content ./content-seed + COPY config ./config +# Entrypoint seeds the volume on first deploy +COPY server/entrypoint.sh /app/entrypoint.sh +RUN chmod +x /app/entrypoint.sh + WORKDIR /app/server ENV NODE_ENV=production ENV REPO_ROOT=/app EXPOSE 3001 +ENTRYPOINT ["/app/entrypoint.sh"] CMD ["npx", "tsx", "src/index.ts"] diff --git a/server/entrypoint.sh b/server/entrypoint.sh new file mode 100644 index 0000000..63ebe22 --- /dev/null +++ b/server/entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +# Seed content into the volume if it's empty (first deploy). +# The Dockerfile copies seed content to /app/content-seed. +# The volume is mounted at /app/content and starts empty. +SEED_DIR="/app/content-seed" +CONTENT_DIR="/app/content" + +if [ -d "$SEED_DIR" ] && [ -d "$CONTENT_DIR" ]; then + # Check if sections directory is missing or empty + if [ ! -d "$CONTENT_DIR/sections" ] || [ -z "$(ls -A "$CONTENT_DIR/sections" 2>/dev/null)" ]; then + echo "Seeding content from $SEED_DIR into $CONTENT_DIR..." + cp -rn "$SEED_DIR/"* "$CONTENT_DIR/" 2>/dev/null || true + echo "Content seeded." + fi +fi + +exec "$@"