Fix Dockerfile to properly expose container service
- Install all dependencies with 'npm ci' instead of production-only - Install 'serve' package globally in container - Use direct serve command with proper host binding (0.0.0.0) - Fix container service accessibility for production deployment
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -7,8 +7,8 @@ WORKDIR /app
|
|||||||
# Copy package files
|
# Copy package files
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies (including serve for production)
|
||||||
RUN npm ci --only=production
|
RUN npm ci
|
||||||
|
|
||||||
# Copy application source
|
# Copy application source
|
||||||
COPY . .
|
COPY . .
|
||||||
@@ -16,8 +16,11 @@ COPY . .
|
|||||||
# Build the application
|
# Build the application
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Install serve globally for production serving
|
||||||
|
RUN npm install -g serve
|
||||||
|
|
||||||
# Expose port 3000
|
# Expose port 3000
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Start the application
|
# Start the application using serve directly
|
||||||
CMD ["npm", "run", "serve"]
|
CMD ["serve", "-s", "build", "-l", "3000", "--host", "0.0.0.0"]
|
||||||
Reference in New Issue
Block a user