Init Main project
This commit is contained in:
commit
9e581ae67f
220 changed files with 253987 additions and 0 deletions
56
Dockerfile
Normal file
56
Dockerfile
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# ---------- TypeScript build stage ----------
|
||||
FROM node:26-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tsconfig.json tsconfig.base.json tsconfig.shared.json tsconfig.server.json tsconfig.client.json ./
|
||||
COPY src ./src
|
||||
COPY public ./public
|
||||
COPY scripts ./scripts
|
||||
COPY data ./data
|
||||
RUN npm run build
|
||||
|
||||
# ---------- Production Node dependencies ----------
|
||||
FROM node:26-alpine AS deps
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --omit=dev && npm cache clean --force
|
||||
|
||||
# ---------- Runtime stage (Arch Linux to match host GMAT glibc ABI) ----------
|
||||
FROM archlinux:latest
|
||||
WORKDIR /app
|
||||
|
||||
RUN pacman -Syu --noconfirm --needed nodejs python python-numpy \
|
||||
&& rm -rf /var/cache/pacman/pkg/* \
|
||||
&& groupadd -g 1000 node \
|
||||
&& useradd -u 1000 -g node -m -s /bin/sh node \
|
||||
&& mkdir -p /app/state /app/state/gmat-work /opt/gmat \
|
||||
&& chown -R node:node /app/state
|
||||
|
||||
ENV NODE_ENV=production \
|
||||
PORT=3000 \
|
||||
DATA_FILE=/app/state/db.json \
|
||||
ML_WEIGHTS_PATH=/app/state/ml_policy_weights.json \
|
||||
GMAT_BIN=/opt/gmat/bin/GmatConsole-R2026a \
|
||||
GMAT_CONSOLE_BIN=/opt/gmat/bin/GmatConsole-R2026a \
|
||||
GMAT_WORK_DIR=/app/state/gmat-work \
|
||||
ML_AI_ENABLED=1 \
|
||||
ML_PYTHON_BIN=python3
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY models ./models
|
||||
COPY --from=build /app/dist ./dist
|
||||
COPY public ./public
|
||||
COPY data ./data
|
||||
COPY scripts/ml_agent.py ./scripts/ml_agent.py
|
||||
|
||||
USER node
|
||||
EXPOSE 3000
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
||||
CMD ["node", "-e", "fetch('http://127.0.0.1:' + (process.env.PORT || 3000) + '/api/info').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"]
|
||||
|
||||
CMD ["node", "dist/server/index.js"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue