53 lines
1.1 KiB
Docker
53 lines
1.1 KiB
Docker
# Build stage
|
|
FROM oven/bun:1 AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Native modules built via node-gyp need Python and a C/C++ toolchain.
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends python3 python-is-python3 make g++ \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy package files
|
|
COPY package.json bun.lockb ./
|
|
|
|
# Install dependencies
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# Copy source code
|
|
COPY src ./src
|
|
COPY tsconfig.json drizzle.config.ts ./
|
|
|
|
RUN bun run css:build
|
|
|
|
# Production stage
|
|
FROM oven/bun:1-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Install runtime dependencies
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ffmpeg ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy from builder
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/src ./src
|
|
COPY --from=builder /app/package.json ./
|
|
COPY --from=builder /app/tsconfig.json ./
|
|
COPY --from=builder /app/drizzle.config.ts ./
|
|
|
|
# Set environment variables
|
|
ENV NODE_ENV=production
|
|
ENV LOG_LEVEL=info
|
|
ENV DATABASE_PATH=/data/db.sqlite3
|
|
ENV WEB_PORT=3000
|
|
|
|
# Persist runtime data (SQLite)
|
|
VOLUME ["/data"]
|
|
|
|
EXPOSE 3000
|
|
|
|
# Run the bot
|
|
CMD ["bun", "run", "src/index.ts"]
|