docker update

This commit is contained in:
2025-10-16 19:33:59 +05:30
parent f3574d607a
commit c4d816086a
2 changed files with 54 additions and 28 deletions

View File

@ -1,32 +1,6 @@
version: "3.9"
services:
frontend:
build:
context: ./fuse-starter-v20.0.0
container_name: vending-frontend
ports:
- "8086:80"
depends_on:
- backend
restart: always
backend:
build:
context: ./Machine-Backend
container_name: vending-backend
env_file:
- ./Machine-Backend/.env
ports:
- "8087:5000"
volumes:
- ./Machine-Backend:/app
depends_on:
- db
restart: always
command: >
sh -c "python seed_user.py && gunicorn --bind 0.0.0.0:5000 run:app"
db:
image: mysql:8.0
container_name: vending-db
@ -40,6 +14,38 @@ services:
- "3307:3306"
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 5s
retries: 10
backend:
build:
context: ./Machine-Backend
container_name: vending-backend
env_file:
- ./Machine-Backend/.env
ports:
- "8087:5000"
volumes:
- ./Machine-Backend:/app
depends_on:
db:
condition: service_healthy
restart: always
command: >
sh -c "python seed_user.py && gunicorn --bind 0.0.0.0:5000 run:app"
frontend:
build:
context: ./fuse-starter-v20.0.0
dockerfile: Dockerfile
container_name: vending-frontend
ports:
- "8086:80"
depends_on:
- backend
restart: always
volumes:
mysql_data:
mysql_data:

View File

@ -1,17 +1,37 @@
# Stage 1: Build Angular application
FROM node:18-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies with legacy peer deps
RUN npm ci --legacy-peer-deps
# Copy all source files
COPY . .
# Development build (much faster - 2-3 minutes)
# Build the application (development mode for faster builds)
RUN npm run build
# Stage 2: Serve with Nginx
FROM nginx:alpine AS production
# Copy built files - check your actual output directory name
# It might be 'fuse-angular' or 'fuse-starter-v20.0.0'
COPY --from=builder /app/dist/fuse-angular /usr/share/nginx/html
# Custom nginx configuration for Angular routing
RUN echo 'server { \
listen 80; \
location / { \
root /usr/share/nginx/html; \
index index.html; \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]