43 lines
No EOL
810 B
Docker
43 lines
No EOL
810 B
Docker
# Use Bun base image for builder
|
|
FROM oven/bun:1-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
COPY bun.lockb* ./
|
|
|
|
# Install dependencies with Bun
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# Copy source files
|
|
COPY . .
|
|
|
|
# Set environment variables for build
|
|
ENV VITE_API_URL=http://localhost/api
|
|
ENV VITE_WS_URL=ws://localhost/ws
|
|
ENV VITE_STREAM_PORT=8088
|
|
|
|
# Build the application
|
|
RUN bun run build
|
|
|
|
# Production stage - can still use Bun
|
|
FROM oven/bun:1-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy built application
|
|
COPY --from=builder /app/build ./build
|
|
COPY --from=builder /app/package*.json ./
|
|
|
|
# Install production dependencies only
|
|
RUN bun install --production
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Set environment to production
|
|
ENV NODE_ENV=production
|
|
|
|
# Run with Bun
|
|
CMD ["bun", "run", "build/index.js"] |