mirror of
https://github.com/StepanovPlaton/AboutMe.git
synced 2026-04-03 20:30:49 +04:00
40 lines
714 B
Docker
40 lines
714 B
Docker
# Stage 1: Build
|
|
FROM node:22-alpine AS builder
|
|
|
|
# Install dependencies for sharp and other native modules
|
|
RUN apk add --no-cache \
|
|
python3 \
|
|
make \
|
|
g++ \
|
|
libc6-compat
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json package-lock.json* ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci --only=production=false
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Stage 2: Production
|
|
FROM nginx:alpine AS production
|
|
|
|
# Copy built files from builder stage
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copy nginx configuration
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Start nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|