beeta/frontend/Dockerfile

54 lines
1.1 KiB
Text
Raw Permalink Normal View History

2025-08-13 12:34:47 -04:00
# Use Bun base image for builder
FROM oven/bun:1-alpine AS builder
2025-08-03 21:53:15 -04:00
WORKDIR /app
# Copy package files
COPY package*.json ./
2026-01-05 22:54:27 -05:00
COPY bun.lock* ./
2025-08-13 12:34:47 -04:00
# Install dependencies with Bun
2026-01-05 22:54:27 -05:00
RUN bun install
2025-08-03 21:53:15 -04:00
# 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
2026-01-05 22:54:27 -05:00
# Nakama game server config
ARG VITE_NAKAMA_SERVER_KEY=defaultkey
ARG VITE_NAKAMA_HOST=localhost
ARG VITE_NAKAMA_PORT=80
ARG VITE_NAKAMA_USE_SSL=false
ENV VITE_NAKAMA_SERVER_KEY=${VITE_NAKAMA_SERVER_KEY}
ENV VITE_NAKAMA_HOST=${VITE_NAKAMA_HOST}
ENV VITE_NAKAMA_PORT=${VITE_NAKAMA_PORT}
ENV VITE_NAKAMA_USE_SSL=${VITE_NAKAMA_USE_SSL}
2025-08-03 21:53:15 -04:00
# Build the application
2025-08-13 12:34:47 -04:00
RUN bun run build
2025-08-03 21:53:15 -04:00
2025-08-13 12:34:47 -04:00
# Production stage - can still use Bun
FROM oven/bun:1-alpine
2025-08-03 21:53:15 -04:00
WORKDIR /app
2026-01-05 22:54:27 -05:00
# Copy built application and lockfile
2025-08-03 21:53:15 -04:00
COPY --from=builder /app/build ./build
COPY --from=builder /app/package*.json ./
2026-01-05 22:54:27 -05:00
COPY --from=builder /app/bun.lock* ./
2025-08-03 21:53:15 -04:00
# Install production dependencies only
2025-08-13 12:34:47 -04:00
RUN bun install --production
2025-08-03 21:53:15 -04:00
# Expose port
EXPOSE 3000
# Set environment to production
ENV NODE_ENV=production
2025-08-13 12:34:47 -04:00
# Run with Bun
CMD ["bun", "run", "build/index.js"]