-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (42 loc) · 1.32 KB
/
Dockerfile
File metadata and controls
52 lines (42 loc) · 1.32 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
# Stage 1: Install dependencies
FROM oven/bun:1 AS deps
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
# Stage 2: Build the app
FROM oven/bun:1 AS build
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
# Allow VITE_POCKETBASE_URL to be set at build time, otherwise leave empty
# so that the runtime dynamic logic can take over.
ARG VITE_POCKETBASE_URL
ENV VITE_POCKETBASE_URL=$VITE_POCKETBASE_URL
RUN bun run build
# Stage 3: Production environment
FROM oven/bun:1-slim AS production
WORKDIR /app
# Ensure we have bash available for the start script
RUN apt-get update && apt-get install -y --no-install-recommends \
bash \
&& rm -rf /var/lib/apt/lists/*
# Copy package info
COPY package.json ./
# Copy built frontend assets
COPY --from=build /app/dist ./dist
# We need node_modules for the SSR server to run
COPY --from=build /app/node_modules ./node_modules
# Copy PocketBase binary and migrations
COPY pocketbase-server ./
COPY pb_migrations ./pb_migrations
# Create a volume for PocketBase data persistence
VOLUME /app/pb_data
# Expose ports for both the Bun frontend and PocketBase backend
EXPOSE 3000
EXPOSE 8090
# Setup the entrypoint
COPY server.ts ./
COPY start.sh ./
RUN chmod +x start.sh
# Use the script to launch both PocketBase and the SSR server
CMD ["./start.sh"]