27 lines
491 B
Docker
27 lines
491 B
Docker
# Use Node.js 18 alpine as base image for smaller size
|
|
FROM node:18-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY app/package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm install
|
|
|
|
# Copy the rest of the application code
|
|
COPY app/ .
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Install a simple HTTP server to serve the built files
|
|
RUN npm install -g serve
|
|
|
|
# Expose port 8080
|
|
EXPOSE 8080
|
|
|
|
# Start the application on port 8080
|
|
CMD ["serve", "-s", "dist", "-l", "8080"]
|