deployment files
This commit is contained in:
41
Dockerfile
Normal file
41
Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
||||
# Stage 1: Build
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json (or yarn.lock)
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci
|
||||
|
||||
# Copy the rest of the app
|
||||
COPY . .
|
||||
|
||||
# Build arguments
|
||||
ARG VITE_WS_HOST
|
||||
ARG VITE_WS_PORT
|
||||
ARG VITE_WS_SKEY
|
||||
|
||||
# Export them as actual environment variables (Vite needs ENV)
|
||||
ENV VITE_WS_HOST=${VITE_WS_HOST}
|
||||
ENV VITE_WS_PORT=${VITE_WS_PORT}
|
||||
ENV VITE_WS_SKEY=${VITE_WS_SKEY}
|
||||
|
||||
# Build
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Static file server (BusyBox)
|
||||
FROM busybox:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only build frontend files
|
||||
COPY --from=builder /app/dist /app
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Default command
|
||||
CMD ["busybox", "httpd", "-f", "-p", "3000"]
|
||||
Reference in New Issue
Block a user