# ⚡ 1. Use Ubuntu Minimal (smaller base image)
FROM ubuntu:22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies & Bun
RUN apt update && apt install -y curl bash unzip libvips \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSL https://bun.sh/install | bash \
&& mv /root/.bun/bin/bun /usr/local/bin/bun
WORKDIR /app
# Copy everything including the packages folder
COPY . .
# Install dependencies (including workspaces)
RUN bun install
# Build **only** the server project
RUN bun run --filter=server build
# ⚡ 3. Use a lightweight runtime image
FROM ubuntu:22.04 AS runner
RUN apt update && apt install -y libvips && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/bun /usr/local/bin/bun
WORKDIR /app
COPY --from=builder /app/apps/server/dist /app
RUN ls -l /app
# Expose backend port
EXPOSE 3001
# Start the backend
CMD ["bun", "run", "index.js"]
# ⚡ 1. Use Ubuntu Minimal (smaller base image)
FROM ubuntu:22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies & Bun
RUN apt update && apt install -y curl bash unzip libvips \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSL https://bun.sh/install | bash \
&& mv /root/.bun/bin/bun /usr/local/bin/bun
WORKDIR /app
# Copy everything including the packages folder
COPY . .
# Install dependencies (including workspaces)
RUN bun install
# Build **only** the server project
RUN bun run --filter=server build
# ⚡ 3. Use a lightweight runtime image
FROM ubuntu:22.04 AS runner
RUN apt update && apt install -y libvips && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/bun /usr/local/bin/bun
WORKDIR /app
COPY --from=builder /app/apps/server/dist /app
RUN ls -l /app
# Expose backend port
EXPOSE 3001
# Start the backend
CMD ["bun", "run", "index.js"]