-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (32 loc) · 1.04 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (32 loc) · 1.04 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
# Stage 1: Builder
FROM denoland/deno:latest AS builder
WORKDIR /app
# Copy lock
COPY ./deno.json /app/deno.json
COPY ./deno.lock /app/deno.lock
# Install dependencies
RUN deno install
# Build frontend (dist/web) and compile backend with static files
COPY ./tasks/vite.ts /app/tasks/vite.ts
COPY ./web /app/web
# Use explicit package to avoid chdb install script failure (Deno bug with npm run -> deno task)
RUN deno cache --allow-scripts=npm:esbuild@0.28.0 --lock=deno.lock tasks/vite.ts web/index.tsx
ENV BASE_URL="/"
RUN deno task prod:vite
# Build API
COPY ./api /app/api
COPY ./db /app/db
RUN deno cache --allow-scripts=npm:esbuild@0.28.0 --lock=deno.lock api/server.ts
RUN deno task prod:api
# Stage 2: Final image
FROM debian:bookworm-slim
WORKDIR /app
# Copy compiled executable and Deno cache
COPY --from=builder /app/dist/api /app/server
COPY --from=builder /app/db/functions /app/db/functions
# Expose port from .env.prod (3021)
EXPOSE 3021
# Run the compiled executable
ARG BASE_URL=/
ENV BASE_URL=${BASE_URL}
CMD ["/app/server", "--env=prod"]