modify pipeline to speed up deployment

This commit is contained in:
SennayT
2026-05-28 12:52:56 +03:00
parent 671d24b81d
commit 342ccb63de
23 changed files with 561 additions and 672 deletions

View File

@@ -0,0 +1,37 @@
# syntax=docker/dockerfile:1
ARG TURBO_FILTER=@edr/freight-portal
ARG APP_PATH=apps/edr-freight-web/portal
ARG VITE_API_URL=http://localhost:3001/api
FROM node:22-alpine AS base
RUN apk add --no-cache libc6-compat
RUN corepack enable
WORKDIR /app
FROM base AS pruner
ARG TURBO_FILTER
COPY . .
RUN pnpm dlx turbo prune "${TURBO_FILTER}" --docker
FROM base AS installer
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN --mount=type=secret,id=npmrc,target=./.npmrc,required=false \
pnpm install --frozen-lockfile
FROM base AS builder
ARG TURBO_FILTER
ARG APP_PATH
ARG VITE_API_URL
ENV VITE_API_URL=${VITE_API_URL}
COPY --from=installer /app/ .
COPY --from=pruner /app/out/full/ .
RUN pnpm turbo build --filter="${TURBO_FILTER}..."
FROM nginx:alpine AS runner
ARG APP_PATH
COPY infrastructure/nginx/spa.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/${APP_PATH}/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -1,126 +0,0 @@
version: "3.9"
networks:
edr-network:
driver: bridge
volumes:
postgres-freight-data:
postgres-passenger-data:
redis-data:
services:
postgres-freight:
image: postgres:17-alpine
container_name: edr-postgres-freight
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: edr_freight
ports:
- "5433:5432"
volumes:
- postgres-freight-data:/var/lib/postgresql/data
networks:
- edr-network
postgres-passenger:
image: postgres:17-alpine
container_name: edr-postgres-passenger
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: edr_passenger
ports:
- "5434:5432"
volumes:
- postgres-passenger-data:/var/lib/postgresql/data
networks:
- edr-network
redis:
image: redis:7-alpine
container_name: edr-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- edr-network
edr-freight-api:
build:
context: ../../
dockerfile: apps/edr-freight-api/Dockerfile
container_name: edr-freight-api
restart: unless-stopped
depends_on:
- postgres-freight
- redis
environment:
NODE_ENV: development
PORT: 3001
DB_HOST: postgres-freight
DB_PORT: 5432
DB_NAME: edr_freight
DB_USER: postgres
DB_PASSWORD: postgres
REDIS_HOST: redis
REDIS_PORT: 6379
ports:
- "3001:3001"
networks:
- edr-network
edr-freight-web:
build:
context: ../../
dockerfile: apps/edr-freight-web/Dockerfile
container_name: edr-freight-web
restart: unless-stopped
depends_on:
- edr-freight-api
ports:
- "5173:5173"
networks:
- edr-network
edr-passenger-api:
build:
context: ../../
dockerfile: apps/edr-passenger-api/Dockerfile
container_name: edr-passenger-api
restart: unless-stopped
depends_on:
- postgres-passenger
- redis
environment:
NODE_ENV: development
PORT: 3002
DB_HOST: postgres-passenger
DB_PORT: 5432
DB_NAME: edr_passenger
DB_USER: postgres
DB_PASSWORD: postgres
REDIS_HOST: redis
REDIS_PORT: 6379
ports:
- "3002:3002"
networks:
- edr-network
edr-passenger-web:
build:
context: ../../
dockerfile: apps/edr-passenger-web/Dockerfile
container_name: edr-passenger-web
restart: unless-stopped
depends_on:
- edr-passenger-api
ports:
- "5174:5174"
networks:
- edr-network

View File

@@ -1,134 +0,0 @@
version: "3.9"
networks:
edr-network:
driver: bridge
volumes:
postgres-freight-data:
postgres-passenger-data:
redis-data:
services:
postgres-freight:
image: postgres:17-alpine
container_name: edr-postgres-freight
restart: always
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME_FREIGHT}
volumes:
- postgres-freight-data:/var/lib/postgresql/data
networks:
- edr-network
postgres-passenger:
image: postgres:17-alpine
container_name: edr-postgres-passenger
restart: always
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME_PASSENGER}
volumes:
- postgres-passenger-data:/var/lib/postgresql/data
networks:
- edr-network
redis:
image: redis:7-alpine
container_name: edr-redis
restart: always
volumes:
- redis-data:/data
networks:
- edr-network
edr-freight-api:
build:
context: ../../
dockerfile: apps/edr-freight-api/Dockerfile
container_name: edr-freight-api
restart: always
depends_on:
- postgres-freight
- redis
environment:
NODE_ENV: production
PORT: 3001
DB_HOST: postgres-freight
DB_PORT: 5432
DB_NAME: ${DB_NAME_FREIGHT}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
REDIS_HOST: redis
expose:
- "3001"
networks:
- edr-network
edr-freight-web:
build:
context: ../../
dockerfile: apps/edr-freight-web/Dockerfile
container_name: edr-freight-web
restart: always
depends_on:
- edr-freight-api
expose:
- "5173"
networks:
- edr-network
edr-passenger-api:
build:
context: ../../
dockerfile: apps/edr-passenger-api/Dockerfile
container_name: edr-passenger-api
restart: always
depends_on:
- postgres-passenger
- redis
environment:
NODE_ENV: production
PORT: 3002
DB_HOST: postgres-passenger
DB_PORT: 5432
DB_NAME: ${DB_NAME_PASSENGER}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
REDIS_HOST: redis
expose:
- "3002"
networks:
- edr-network
edr-passenger-web:
build:
context: ../../
dockerfile: apps/edr-passenger-web/Dockerfile
container_name: edr-passenger-web
restart: always
depends_on:
- edr-passenger-api
expose:
- "5174"
networks:
- edr-network
nginx:
image: nginx:1.27-alpine
container_name: edr-nginx
restart: always
ports:
- "80:80"
depends_on:
- edr-freight-web
- edr-freight-api
- edr-passenger-web
- edr-passenger-api
volumes:
- ../../infrastructure/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
networks:
- edr-network