-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (42 loc) · 2.41 KB
/
Dockerfile
File metadata and controls
57 lines (42 loc) · 2.41 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
# ─────────────────────────────────────────────────────────────────────────────
# Stage 1: Build
# Installs all deps (including Vite/Tailwind build tools) and compiles
# the Fresh app into _fresh/
# ─────────────────────────────────────────────────────────────────────────────
FROM denoland/deno:latest AS builder
WORKDIR /app
ENV DENO_NO_UPDATE_CHECK=1
ENV DENO_NO_PROMPT=1
# Copy dependency manifests first so Docker can cache the install layer
COPY deno.json deno.lock ./
# Install all dependencies (npm postinstall scripts needed for esbuild/tailwind)
RUN deno install --allow-scripts=npm:@tailwindcss/oxide,npm:esbuild,npm:sharp
# Copy source
COPY . .
# Build Fresh app → produces _fresh/
RUN deno task build
# ─────────────────────────────────────────────────────────────────────────────
# Stage 2: Runtime
# Lean image with only what's needed to serve the built app
# ─────────────────────────────────────────────────────────────────────────────
FROM denoland/deno:latest
WORKDIR /app
ENV DENO_NO_UPDATE_CHECK=1
ENV DENO_NO_PROMPT=1
ENV PORT=8011
# Copy built output
COPY --from=builder /app/_fresh ./_fresh
COPY --from=builder /app/static ./static
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/deno.json ./deno.json
COPY --from=builder /app/deno.lock ./deno.lock
COPY --from=builder /app/bot ./bot
COPY --from=builder /app/calls ./calls
COPY --from=builder /app/db ./db
# Persistent data dir (DB files + uploads) — overridden by Docker volume in production
RUN mkdir -p data/uploads
EXPOSE 8011
# Health check — pings the projects API
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD deno eval "const r = await fetch('http://localhost:8011/api/projects'); if (!r.ok) Deno.exit(1);"
CMD ["deno", "serve", "-A", "--port=8011", "--host=0.0.0.0", "_fresh/server.js"]