28 lines
842 B
Docker
28 lines
842 B
Docker
# Use a lightweight Node.js image
|
|
FROM node:20-alpine
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy package.json and lock files from the viewer directory first
|
|
# to leverage Docker layer caching
|
|
COPY viewer/package.json viewer/pnpm-lock.yaml* ./
|
|
|
|
# Install pnpm globally
|
|
RUN npm install -g pnpm
|
|
|
|
# Install all dependencies (including devDependencies for Vite)
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy the rest of the application source code from the viewer directory
|
|
COPY viewer/ ./
|
|
|
|
# Build the application for production
|
|
RUN pnpm build
|
|
|
|
# Expose the port Vite preview will run on
|
|
EXPOSE 3000
|
|
|
|
# The command to run the app using Vite's preview server
|
|
# --host 0.0.0.0 is crucial to make the server accessible from outside the container
|
|
CMD ["pnpm", "exec", "vite", "preview", "--host", "0.0.0.0", "--port", "3000"] |