20 lines
536 B
Docker
20 lines
536 B
Docker
# Use Node.js 20 Alpine as the base image
|
|
FROM node:22-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and package-lock.json (if exists) to leverage Docker cache
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies in a single RUN command to reduce layers
|
|
RUN npm install
|
|
|
|
# Copy the rest of the application code
|
|
COPY . .
|
|
|
|
# Expose Vite's default port
|
|
EXPOSE 8080
|
|
|
|
# Install deps then dev server (needed when /app/node_modules is a Docker volume).
|
|
CMD ["sh", "-c", "npm install && npm run dev -- --host 0.0.0.0 --port 8080"] |