-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathDockerfile.api
More file actions
54 lines (38 loc) · 1.41 KB
/
Dockerfile.api
File metadata and controls
54 lines (38 loc) · 1.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
# Stage 1: Build everything except bubblelab-api with Node + pnpm
FROM node:20-slim AS builder
RUN corepack enable
WORKDIR /workspace
# Copy workspace files
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
COPY .npmrc ./.
COPY packages ./packages/
COPY apps ./apps/
COPY tools ./tools/
# Install all dependencies
RUN pnpm install --frozen-lockfile
# Build bubble-core (but not bubblelab-api yet)
RUN cd packages/bubble-shared-schemas && pnpm run build
RUN cd packages/bubble-core && pnpm run build
RUN cd packages/bubble-runtime && pnpm run build
# Stage 2: Build bubblelab-api with Bun
FROM oven/bun:1.1.38-debian AS runtime
# Install Python and pip
RUN apt-get update && apt-get install -y python3 python3-pip && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy workspace from builder
COPY --from=builder /workspace ./
# Install Python requirements
RUN pip3 install -r packages/bubble-core/scripts/requirements.txt
# Accept DATABASE_URL at build time and expose it to subsequent steps
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}
ENV PYTHON_PATH=/usr/bin/python3
# Reinstall dependencies for correct architecture (skip postinstall scripts)
RUN bun install --frozen-lockfile --ignore-scripts
# Set working directory to API
WORKDIR /app/apps/bubblelab-api
# Create data directory
RUN mkdir -p data
EXPOSE 3001
# Generate schema and run migrations at startup, then start the app
CMD ["sh", "-c", "bun run src/index.ts"]