superdaobo commited on
Commit ·
66866f0
1
Parent(s): 11ff439
Add cloudflared tunnel inside container for custom domain proxy
Browse files- Dockerfile +4 -2
- server/scripts/docker-entrypoint.sh +6 -0
Dockerfile
CHANGED
|
@@ -33,11 +33,13 @@ ENV NODE_ENV=production \
|
|
| 33 |
PORT=3000 \
|
| 34 |
DATABASE_URL="file:/data/db.sqlite"
|
| 35 |
|
| 36 |
-
RUN apk add --no-cache openssl su-exec \
|
| 37 |
&& addgroup -S appgroup \
|
| 38 |
&& adduser -S appuser -G appgroup \
|
| 39 |
&& mkdir -p /data /app/prisma /app/web/dist \
|
| 40 |
-
&& chown -R appuser:appgroup /app /data
|
|
|
|
|
|
|
| 41 |
|
| 42 |
COPY --from=serverbuild --chown=appuser:appgroup /server/package.json ./package.json
|
| 43 |
COPY --from=serverbuild --chown=appuser:appgroup /server/node_modules ./node_modules
|
|
|
|
| 33 |
PORT=3000 \
|
| 34 |
DATABASE_URL="file:/data/db.sqlite"
|
| 35 |
|
| 36 |
+
RUN apk add --no-cache openssl su-exec curl \
|
| 37 |
&& addgroup -S appgroup \
|
| 38 |
&& adduser -S appuser -G appgroup \
|
| 39 |
&& mkdir -p /data /app/prisma /app/web/dist \
|
| 40 |
+
&& chown -R appuser:appgroup /app /data \
|
| 41 |
+
&& curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o /usr/local/bin/cloudflared \
|
| 42 |
+
&& chmod +x /usr/local/bin/cloudflared
|
| 43 |
|
| 44 |
COPY --from=serverbuild --chown=appuser:appgroup /server/package.json ./package.json
|
| 45 |
COPY --from=serverbuild --chown=appuser:appgroup /server/node_modules ./node_modules
|
server/scripts/docker-entrypoint.sh
CHANGED
|
@@ -51,6 +51,12 @@ fi
|
|
| 51 |
|
| 52 |
fix_sqlite_permissions
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
if [ "$(id -u)" -eq 0 ]; then
|
| 55 |
exec su-exec appuser "$@"
|
| 56 |
fi
|
|
|
|
| 51 |
|
| 52 |
fix_sqlite_permissions
|
| 53 |
|
| 54 |
+
# Start cloudflared tunnel in background if TUNNEL_TOKEN is set
|
| 55 |
+
if [ -n "${TUNNEL_TOKEN:-}" ]; then
|
| 56 |
+
echo "Starting cloudflared tunnel..."
|
| 57 |
+
cloudflared tunnel run --token "$TUNNEL_TOKEN" --protocol http2 &
|
| 58 |
+
fi
|
| 59 |
+
|
| 60 |
if [ "$(id -u)" -eq 0 ]; then
|
| 61 |
exec su-exec appuser "$@"
|
| 62 |
fi
|