fix: Resolve Docker build failure by installing dev dependencies
- Change npm ci to install all dependencies (including devDependencies) during build stage
- Run npm ci --only=production after build to minimize final image size
- Fix CMD instruction to use JSON format (resolves Docker warning)
class-variance-authority, tailwindcss, postcss, and other build tools are required during the build process and were missing when using --only=production flag initially.
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
20d0993b06
commit
b555203dc7
@ -8,8 +8,8 @@ WORKDIR /app
|
|||||||
# Copy package files
|
# Copy package files
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install dependencies
|
# Install all dependencies (including dev) needed for build
|
||||||
RUN npm ci --only=production
|
RUN npm ci
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
@ -17,6 +17,9 @@ COPY . .
|
|||||||
# Build the application
|
# Build the application
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Install only production dependencies for runtime
|
||||||
|
RUN npm ci --only=production
|
||||||
|
|
||||||
# Stage 2: Production image with Nginx
|
# Stage 2: Production image with Nginx
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
@ -43,4 +46,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|||||||
CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1
|
CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1
|
||||||
|
|
||||||
# Start both nginx and the API server
|
# Start both nginx and the API server
|
||||||
CMD sh -c "node /app/server.js & nginx -g 'daemon off;'"
|
CMD ["sh", "-c", "node /app/server.js & nginx -g 'daemon off;'"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user