mirror of
https://github.com/Codennnn/vue-color-avatar.git
synced 2025-02-22 05:59:07 +00:00
- Transitioned from Yarn to pnpm for package management, updating package.json scripts accordingly. - Enhanced Dockerfile for better build efficiency by separating dependency installation and application build steps. - Updated Docker commands in README files to reflect changes in port mapping and image tagging. - Added healthcheck to the Dockerfile for improved container reliability.
35 lines
720 B
Docker
35 lines
720 B
Docker
# Build stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install dependencies first (for better caching)
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN corepack enable pnpm && pnpm install --frozen-lockfile
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN pnpm build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Copy custom nginx config if needed
|
|
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy built assets from builder stage
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Add healthcheck
|
|
HEALTHCHECK --interval=30s --timeout=3s \
|
|
CMD wget --quiet --tries=1 --spider http://localhost:80/ || exit 1
|
|
|
|
# Expose port
|
|
EXPOSE 80
|
|
|
|
# Start nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|