-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (56 loc) · 1.66 KB
/
Dockerfile
File metadata and controls
72 lines (56 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# syntax=docker/dockerfile:1.19.0
# -------------------------------------------------------------------
# Author: Zenkiet
# -------------------------------------------------------------------
ARG BUN_IMAGE=oven/bun:alpine
ARG TRAEFIK_VERSION=v3.6.10
ARG CLOUDFLARED_VERSION=2026.2.0
# Stage 1: Build Frontend
FROM ${BUN_IMAGE} AS builder
WORKDIR /app
# Copy dependency
COPY package.json ./
COPY bun.lock* ./
COPY src ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy source and build
COPY . .
RUN bun run build
# Remove devDependencies after build
RUN bun install --frozen-lockfile --production && \
rm -rf .cache
# Stage 2: Runtime
FROM ${BUN_IMAGE}
LABEL maintainer="Zenkiet" \
description="Traefik reverse proxy with Cloudflared tunnel and Svelte dashboard"
# Install runtime dependencies
RUN set -eux; \
if command -v apk >/dev/null 2>&1; then \
apk add --no-cache bash curl libstdc++ jq yq ca-certificates gettext; \
update-ca-certificates; \
elif command -v apt-get >/dev/null 2>&1; then \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
bash \
curl \
jq \
yq \
ca-certificates \
gettext; \
update-ca-certificates; \
rm -rf /var/lib/apt/lists/*; \
else \
echo "Unsupported base image: ${BUN_IMAGE}" >&2; \
exit 1; \
fi
ENV TRAEFIK_VERSION=${TRAEFIK_VERSION} \
CLOUDFLARED_VERSION=${CLOUDFLARED_VERSION} \
NODE_ENV=production
WORKDIR /app
COPY --link config/ /tmp/tpl/
COPY --link --chmod=755 scripts/ /opt/scripts/
COPY --link --chmod=755 entrypoint.sh ./entrypoint.sh
COPY --link --from=builder /app/build /opt/dashboard/
EXPOSE 80 443 8080 3000
CMD ["./entrypoint.sh"]