cms: Site beim Container-Start bauen (sonst 404 auf / vor erstem Publish)
public/ ist git-ignored und fehlt im frischen Clone — Entrypoint baut die Hugo-Site einmal aus content/. Ausserdem: Script-Output stellt klar, dass :8000 nur das API-Gateway ist (keine Web-UI). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -33,9 +33,10 @@ WORKDIR /app
|
|||||||
COPY api/package.json api/package-lock.json* ./
|
COPY api/package.json api/package-lock.json* ./
|
||||||
RUN npm install --omit=dev --no-audit --no-fund
|
RUN npm install --omit=dev --no-audit --no-fund
|
||||||
COPY api/src ./src
|
COPY api/src ./src
|
||||||
|
COPY api/entrypoint.sh ./entrypoint.sh
|
||||||
COPY --from=admin /admin/dist ./admin-dist
|
COPY --from=admin /admin/dist ./admin-dist
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV ADMIN_DIR=/app/admin-dist
|
ENV ADMIN_DIR=/app/admin-dist
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD ["node", "src/index.js"]
|
CMD ["sh", "/app/entrypoint.sh"]
|
||||||
|
|||||||
Executable
+16
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Beim Container-Start die Hugo-Site einmal bauen, damit die Live-Seite (/)
|
||||||
|
# sofort steht — auch vor dem ersten Publish. public/ ist git-ignored und
|
||||||
|
# existiert im frischen Clone nicht; ohne diesen Build gäbe es 404 auf /.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SITE_DIR="${SITE_DIR:-/site}"
|
||||||
|
|
||||||
|
echo "→ Initialer Hugo-Build ($SITE_DIR → public/)…"
|
||||||
|
if hugo --source "$SITE_DIR" --destination "$SITE_DIR/public" --cleanDestinationDir; then
|
||||||
|
echo "✓ Live-Seite gebaut."
|
||||||
|
else
|
||||||
|
echo "WARN: Hugo-Build fehlgeschlagen — Live-Seite bleibt leer bis zum ersten Publish."
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec node src/index.js
|
||||||
@@ -159,7 +159,7 @@ cat <<EOF
|
|||||||
|
|
||||||
Admin: http://${IPADDR:-<ip>}:8080/admin/
|
Admin: http://${IPADDR:-<ip>}:8080/admin/
|
||||||
Live: http://${IPADDR:-<ip>}:8080/
|
Live: http://${IPADDR:-<ip>}:8080/
|
||||||
Supabase: http://${IPADDR:-<ip>}:8000
|
Supabase: http://${IPADDR:-<ip>}:8000 (nur API-Gateway, keine Web-UI — / gibt 404, ist normal)
|
||||||
|
|
||||||
Login-User anlegen (im Container, nach dem Start):
|
Login-User anlegen (im Container, nach dem Start):
|
||||||
pct enter ${CTID}
|
pct enter ${CTID}
|
||||||
@@ -172,8 +172,8 @@ Login-User anlegen (im Container, nach dem Start):
|
|||||||
-d '{"email":"karim@gabrielevarano.ch","password":"DEIN-PASSWORT","email_confirm":true}'
|
-d '{"email":"karim@gabrielevarano.ch","password":"DEIN-PASSWORT","email_confirm":true}'
|
||||||
|
|
||||||
Hinweise:
|
Hinweise:
|
||||||
• Privates Repo: GIT_TOKEN oben setzen (Format "tokenname:tokenwert"),
|
• :8000 ist das Supabase-API-Gateway (Kong), keine Web-Oberfläche.
|
||||||
sonst schlägt der Clone fehl.
|
Das Admin-Login (:8080/admin/) spricht im Hintergrund damit.
|
||||||
• Für Domain/HTTPS: SITE_URL + API_EXTERNAL_URL in .env auf die
|
• Für Domain/HTTPS: SITE_URL + API_EXTERNAL_URL in .env auf die
|
||||||
öffentliche Adresse setzen und 'docker compose up -d --build' neu.
|
öffentliche Adresse setzen und 'docker compose up -d --build' neu.
|
||||||
• Logs: pct enter ${CTID}; cd ${APP_DIR}/cms; docker compose logs -f
|
• Logs: pct enter ${CTID}; cd ${APP_DIR}/cms; docker compose logs -f
|
||||||
|
|||||||
Reference in New Issue
Block a user