33 lines
640 B
Docker
33 lines
640 B
Docker
# Use the official Bun base image
|
|
FROM oven/bun:latest AS base
|
|
|
|
# Set the working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json bun.lock* ./
|
|
|
|
# Install dependencies
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# Copy source code
|
|
COPY src ./src
|
|
COPY tsconfig.json ./
|
|
|
|
# Build the application for production
|
|
RUN bun build ./src/index.ts --outdir ./dist --minify --target=bun
|
|
|
|
# Multi-stage build - runtime stage
|
|
FROM oven/bun:latest AS runtime
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy the built application from the base stage
|
|
COPY --from=base /app/dist/ ./
|
|
|
|
# Expose the port the app runs on
|
|
EXPOSE 3000
|
|
|
|
# Start the application
|
|
CMD ["bun", "index.js"]
|