sangwaritaxi_website/Dockerfile

33 lines
747 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 ./
RUN npm install
# Fix Windows line endings and permissions for Vite binary
RUN apt-get update && apt-get install -y dos2unix
RUN dos2unix node_modules/.bin/vite
RUN chmod +x node_modules/.bin/vite
# 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"]