41 lines
1018 B
Docker
41 lines
1018 B
Docker
# Use the official Bun image
|
|
FROM oven/bun:latest
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files first for caching
|
|
COPY package.json bun.lock ./
|
|
COPY packages/client/package.json ./packages/client/
|
|
COPY packages/server/package.json ./packages/server/
|
|
COPY packages/shared/package.json ./packages/shared/
|
|
|
|
# Install dependencies
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# Copy the rest of the application
|
|
COPY . .
|
|
|
|
# Build the client (Vite) and server (TSC)
|
|
# ensuring the environment variables are set for the build if needed
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
# Build packages individually by changing directory
|
|
WORKDIR /app/packages/shared
|
|
RUN bun run build
|
|
|
|
WORKDIR /app/packages/server
|
|
RUN bun run build
|
|
|
|
WORKDIR /app/packages/client
|
|
RUN bun run build
|
|
|
|
# Reset working directory
|
|
WORKDIR /app
|
|
|
|
# Expose the port (Dokku will override PORT env var, but 3000 is a good default documentation)
|
|
EXPOSE 3000
|
|
|
|
# Start the server
|
|
CMD ["bun", "packages/server/src/index.ts"]
|