Files
joel/Dockerfile

53 lines
1.2 KiB
Docker

# Build stage
FROM oven/bun:1.2.15 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. Bun 1.2.x is pinned here for @discordjs/opus ABI compatibility.
RUN bun install
# Copy source code
COPY src ./src
COPY tsconfig.json drizzle.config.ts ./
RUN bun run css:build
# Production stage
FROM oven/bun:1.2.15-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"]