build: switch frontend and worker to Dockerfile images

This commit is contained in:
Ruslan Bakiev
2026-02-20 11:51:26 +07:00
parent e1f301c913
commit a20b6ebb5a
4 changed files with 50 additions and 22 deletions

9
Frontend/.dockerignore Normal file
View File

@@ -0,0 +1,9 @@
.git
.gitignore
node_modules
.nuxt
.output
.data
npm-debug.log*
dist
coverage

20
Frontend/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
FROM node:22-bookworm-slim
WORKDIR /app/frontend
COPY package*.json ./
RUN npm ci --legacy-peer-deps
COPY . .
# Build server bundle at image build time.
RUN npx prisma generate && npm run build
ENV NODE_ENV=production
ENV NITRO_HOST=0.0.0.0
ENV NITRO_PORT=3000
EXPOSE 3000
# Keep schema in sync, then start Nitro production server.
CMD ["bash", "-lc", "npx prisma db push && node .output/server/index.mjs"]

View File

@@ -0,0 +1,15 @@
FROM node:22-bookworm-slim
WORKDIR /app/delivery
COPY package*.json ./
# Worker does not need Nuxt postinstall hooks.
RUN npm install --ignore-scripts --legacy-peer-deps
COPY . .
RUN npx prisma generate
ENV NODE_ENV=production
CMD ["npm", "run", "worker:delivery"]

View File

@@ -1,11 +1,8 @@
services:
frontend:
image: node:22-bookworm-slim
working_dir: /app/frontend
volumes:
- ./Frontend:/app/frontend
- frontend_node_modules:/app/frontend/node_modules
- frontend_nuxt:/app/frontend/.nuxt
build:
context: ./Frontend
dockerfile: Dockerfile
expose:
- "3000"
environment:
@@ -27,10 +24,6 @@ services:
# Set this in your shell or a compose override:
# OPENROUTER_API_KEY: "..."
# GIGACHAT_AUTH_KEY: "..." (if you use GigaChat integration)
command: >
bash -lc "
./scripts/compose-dev.sh
"
depends_on:
- langfuse-web
labels:
@@ -51,20 +44,14 @@ services:
- dokploy-network
delivery:
image: node:22-bookworm-slim
working_dir: /app/delivery
volumes:
- ./Frontend:/app/delivery
- delivery_node_modules:/app/delivery/node_modules
build:
context: ./Frontend
dockerfile: Dockerfile.worker
environment:
DATABASE_URL: "${DATABASE_URL:-postgresql://postgres:dpb6gmj1umjhohso@crm-sql-q57r8m:5432/postgres?schema=public}"
REDIS_URL: "${REDIS_URL:-redis://default:nw0mv1pemhnbh7gw@crm-redis-vkpxku:6379}"
TELEGRAM_API_BASE: "${TELEGRAM_API_BASE:-https://api.telegram.org}"
TELEGRAM_BOT_TOKEN: "${TELEGRAM_BOT_TOKEN:-}"
command: >
bash -lc "
bash ./scripts/compose-worker.sh
"
networks:
- default
- dokploy-network
@@ -201,9 +188,6 @@ services:
start_period: 5s
volumes:
frontend_node_modules:
frontend_nuxt:
delivery_node_modules:
langfuse_postgres_data:
langfuse_clickhouse_data:
langfuse_clickhouse_logs: