Fix docker build context permanently via .dockerignore + tar verify

This commit is contained in:
Hannes Ahlin
2026-08-22 15:30:25 +02:00
parent c44e3fe1ef
commit 0dfb5b45d2
3 changed files with 123 additions and 18 deletions
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Engångsfix på servern om docker build context failar
set -euo pipefail
NODERED_DIR="${1:-/home/ncadmin/nextcloud-node-red}"
USER="${2:-ncadmin}"
DI="${NODERED_DIR}/.dockerignore"
echo "[fix] ${NODERED_DIR}"
chown -R "${USER}:${USER}" "${NODERED_DIR}"
find "${NODERED_DIR}/nodes" -type d -exec chmod u+rwx,go+rx {} + 2>/dev/null || true
find "${NODERED_DIR}/nodes" -type f -exec chmod u+rw,go+r {} + 2>/dev/null || true
if ! grep -q "nextcloud-collabora-nodered" "${DI}" 2>/dev/null; then
cat >> "${DI}" <<'EOF'
# nextcloud-collabora-nodered
nodes/odds-scraper/odds-scraper
.git
.vscode
**/*.deb
winboat*
**/node_modules
EOF
fi
tar -cf /dev/null --exclude-from="${DI}" -C "${NODERED_DIR}" . \
&& echo "[fix] Build context OK — kör ./install.sh"