31 lines
645 B
Docker
31 lines
645 B
Docker
# Stage 1: Build
|
|
FROM node:20-bullseye AS builder
|
|
WORKDIR /app
|
|
|
|
# Copy package files and install dependencies
|
|
COPY package.json package-lock.json ./
|
|
# ...existing code...
|
|
RUN npm install
|
|
RUN chmod +x node_modules/.bin/vite
|
|
# ...existing code...
|
|
|
|
# Copy the rest of the source code
|
|
COPY . .
|
|
|
|
# Set environment variable for Vite (customize as needed)
|
|
ENV VITE_API_BASE_URL=https://navigolabs.com/api
|
|
|
|
# Build the Vite app
|
|
RUN npm run build
|
|
|
|
# Stage 2: Serve with Node
|
|
FROM node:20-bullseye
|
|
WORKDIR /app
|
|
|
|
RUN npm install -g serve
|
|
|
|
# Copy build output from builder
|
|
COPY --from=builder /app/build .
|
|
|
|
EXPOSE 3000
|
|
CMD ["serve", "-s", ".", "-l", "3000"] |