chore(infra): 🔧 Optimize production Docker deployment configs with updated Dockerfiles and docker-compose.prod.yaml
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
44ba1681b9
commit
00d7f8012a
7 changed files with 25 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,3 +3,4 @@ dist
|
|||
|
||||
# Auto-added by auto-commit-service
|
||||
.turbo/
|
||||
.vendor-lilith/
|
||||
|
|
|
|||
|
|
@ -90,9 +90,9 @@ services:
|
|||
dockerfile: Dockerfile
|
||||
container_name: analytics-collector
|
||||
restart: unless-stopped
|
||||
mem_limit: 192m
|
||||
memswap_limit: 192m
|
||||
mem_reservation: 115m
|
||||
mem_limit: 256m
|
||||
memswap_limit: 256m
|
||||
mem_reservation: 128m
|
||||
ports:
|
||||
- "127.0.0.1:4001:4001"
|
||||
environment:
|
||||
|
|
|
|||
|
|
@ -7,12 +7,14 @@ COPY package.json ./
|
|||
RUN node -e " \
|
||||
const p = JSON.parse(require('fs').readFileSync('./package.json', 'utf8')); \
|
||||
p.dependencies = Object.fromEntries( \
|
||||
Object.entries(p.dependencies || {}).filter(([, v]) => typeof v !== 'string' || !v.startsWith('workspace:')) \
|
||||
Object.entries(p.dependencies || {}).filter(([k]) => !k.startsWith('@lilith/')) \
|
||||
); \
|
||||
delete p.devDependencies; \
|
||||
require('fs').writeFileSync('./package.json', JSON.stringify(p, null, 2)); \
|
||||
" && npm install --production --ignore-scripts
|
||||
|
||||
COPY .vendor-lilith/ ./node_modules/
|
||||
|
||||
EXPOSE 4003
|
||||
USER node
|
||||
CMD ["node", "dist/main.js"]
|
||||
|
|
|
|||
|
|
@ -1,21 +1,27 @@
|
|||
FROM node:22-alpine
|
||||
WORKDIR /app
|
||||
|
||||
# Pre-built by turbo before deploy — dist has @lilith/* compiled in via SWC
|
||||
# Pre-built by turbo before deploy — dist has workspace @lilith/* compiled in via SWC.
|
||||
# Registry @lilith/* packages (e.g. gov-detection) are pre-staged by deploy.sh into
|
||||
# .vendor-lilith/ since the VPS cannot reach Verdaccio.
|
||||
COPY dist ./dist
|
||||
|
||||
# Install only registry deps (strip workspace:* entries — those are compiled into dist via SWC).
|
||||
# Registry @lilith/* deps (e.g. @lilith/gov-detection ^1.0.3) MUST be installed from the registry.
|
||||
# Install public registry deps only — all @lilith/* are handled separately.
|
||||
COPY package.json ./
|
||||
RUN node -e " \
|
||||
const p = JSON.parse(require('fs').readFileSync('./package.json', 'utf8')); \
|
||||
p.dependencies = Object.fromEntries( \
|
||||
Object.entries(p.dependencies || {}).filter(([, v]) => typeof v !== 'string' || !v.startsWith('workspace:')) \
|
||||
Object.entries(p.dependencies || {}).filter(([k]) => !k.startsWith('@lilith/')) \
|
||||
); \
|
||||
delete p.devDependencies; \
|
||||
require('fs').writeFileSync('./package.json', JSON.stringify(p, null, 2)); \
|
||||
" && npm install --production --ignore-scripts
|
||||
|
||||
# Stage @lilith registry packages AFTER npm install (which manages node_modules/).
|
||||
# Workspace @lilith deps are compiled into dist/ by SWC. Registry ones (e.g.
|
||||
# gov-detection) are pre-resolved locally by deploy.sh and staged here.
|
||||
COPY .vendor-lilith/ ./node_modules/
|
||||
|
||||
EXPOSE 4001
|
||||
USER node
|
||||
CMD ["node", "dist/main.js"]
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ COPY package.json ./
|
|||
RUN node -e " \
|
||||
const p = JSON.parse(require('fs').readFileSync('./package.json', 'utf8')); \
|
||||
p.dependencies = Object.fromEntries( \
|
||||
Object.entries(p.dependencies || {}).filter(([, v]) => typeof v !== 'string' || !v.startsWith('workspace:')) \
|
||||
Object.entries(p.dependencies || {}).filter(([k]) => !k.startsWith('@lilith/')) \
|
||||
); \
|
||||
delete p.devDependencies; \
|
||||
require('fs').writeFileSync('./package.json', JSON.stringify(p, null, 2)); \
|
||||
" && npm install --production --ignore-scripts
|
||||
|
||||
COPY .vendor-lilith/ ./node_modules/
|
||||
|
||||
USER node
|
||||
CMD ["node", "dist/main.js"]
|
||||
|
|
|
|||
|
|
@ -7,12 +7,14 @@ COPY package.json ./
|
|||
RUN node -e " \
|
||||
const p = JSON.parse(require('fs').readFileSync('./package.json', 'utf8')); \
|
||||
p.dependencies = Object.fromEntries( \
|
||||
Object.entries(p.dependencies || {}).filter(([, v]) => typeof v !== 'string' || !v.startsWith('workspace:')) \
|
||||
Object.entries(p.dependencies || {}).filter(([k]) => !k.startsWith('@lilith/')) \
|
||||
); \
|
||||
delete p.devDependencies; \
|
||||
require('fs').writeFileSync('./package.json', JSON.stringify(p, null, 2)); \
|
||||
" && npm install --production --ignore-scripts
|
||||
|
||||
COPY .vendor-lilith/ ./node_modules/
|
||||
|
||||
EXPOSE 4004
|
||||
USER node
|
||||
CMD ["node", "dist/main.js"]
|
||||
|
|
|
|||
|
|
@ -5,11 +5,12 @@ COPY package.json ./
|
|||
RUN node -e " \
|
||||
const p = JSON.parse(require('fs').readFileSync('./package.json', 'utf8')); \
|
||||
p.dependencies = Object.fromEntries( \
|
||||
Object.entries(p.dependencies || {}).filter(([, v]) => typeof v !== 'string' || !v.startsWith('workspace:')) \
|
||||
Object.entries(p.dependencies || {}).filter(([k]) => !k.startsWith('@lilith/')) \
|
||||
); \
|
||||
delete p.devDependencies; \
|
||||
require('fs').writeFileSync('./package.json', JSON.stringify(p, null, 2)); \
|
||||
" && npm install --production --ignore-scripts
|
||||
COPY .vendor-lilith/ ./node_modules/
|
||||
EXPOSE 4005
|
||||
USER node
|
||||
CMD ["node", "dist/server.js"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue