docker update
This commit is contained in:
@ -1,32 +1,6 @@
|
|||||||
version: "3.9"
|
version: "3.9"
|
||||||
|
|
||||||
services:
|
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:
|
db:
|
||||||
image: mysql:8.0
|
image: mysql:8.0
|
||||||
container_name: vending-db
|
container_name: vending-db
|
||||||
@ -40,6 +14,38 @@ services:
|
|||||||
- "3307:3306"
|
- "3307:3306"
|
||||||
volumes:
|
volumes:
|
||||||
- mysql_data:/var/lib/mysql
|
- 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:
|
volumes:
|
||||||
mysql_data:
|
mysql_data:
|
||||||
@ -1,17 +1,37 @@
|
|||||||
# Stage 1: Build Angular application
|
# Stage 1: Build Angular application
|
||||||
FROM node:18-alpine AS builder
|
FROM node:18-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install dependencies with legacy peer deps
|
||||||
RUN npm ci --legacy-peer-deps
|
RUN npm ci --legacy-peer-deps
|
||||||
|
|
||||||
|
# Copy all source files
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Development build (much faster - 2-3 minutes)
|
# Build the application (development mode for faster builds)
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Stage 2: Serve with Nginx
|
# Stage 2: Serve with Nginx
|
||||||
FROM nginx:alpine AS production
|
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
|
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
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Reference in New Issue
Block a user