40 lines
767 B
Docker
40 lines
767 B
Docker
# Build stage
|
|
FROM node:20-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
# Accept API and WebSocket URLs as build arguments
|
|
ARG VITE_API_URL=https://api-staging.echoesoftheash.com
|
|
ARG VITE_WS_URL=wss://api-staging.echoesoftheash.com
|
|
ENV VITE_API_URL=$VITE_API_URL
|
|
ENV VITE_WS_URL=$VITE_WS_URL
|
|
|
|
# Copy package files
|
|
COPY pwa/package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy source code
|
|
COPY pwa/ ./
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Copy built assets from build stage
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
# Copy game images
|
|
COPY images/ /usr/share/nginx/html/images/
|
|
|
|
# Copy nginx configuration
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Expose port
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|