update docker files
This commit is contained in:
@@ -1,33 +1,25 @@
|
|||||||
# Multi-stage build for production
|
# Stage 1: Build the Vite application
|
||||||
# Stage 1: Build the React application
|
|
||||||
FROM node:20-alpine AS build
|
FROM node:20-alpine AS build
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files
|
|
||||||
COPY package.json yarn.lock ./
|
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
|
COPY package.json yarn.lock ./
|
||||||
RUN yarn install --frozen-lockfile
|
RUN yarn install --frozen-lockfile
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code and build
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build the application for production
|
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
# Stage 2: Serve with nginx
|
# Stage 2: Serve with nginx
|
||||||
FROM nginx:alpine
|
FROM nginx:1.27-alpine
|
||||||
|
|
||||||
# Copy custom nginx configuration
|
# Copy nginx configuration tuned for a single-page application
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# Copy built application from build stage
|
# Copy built assets
|
||||||
COPY --from=build /app/build /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# Expose port 80
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
# Start nginx
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
@@ -6,7 +6,7 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.prod
|
dockerfile: Dockerfile.prod
|
||||||
ports:
|
ports:
|
||||||
- '3009:80'
|
- '3010:80'
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
env_file:
|
env_file:
|
||||||
@@ -15,7 +15,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- dashboard-network
|
- dashboard-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'curl', '-f', 'http://localhost/health']
|
test: ['CMD', 'curl', '-f', 'http://localhost/']
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- '3008:3000'
|
- '3011:3000'
|
||||||
volumes:
|
volumes:
|
||||||
# Mount source code for hot reloading
|
# Mount source code for hot reloading
|
||||||
- .:/app
|
- .:/app
|
||||||
|
|||||||
Reference in New Issue
Block a user