Files
MikrotikManager/backend/Dockerfile
T
Denozordec a359874a42
Docker images / backend-image (push) Successful in 2m32s
Docker images / frontend-image (push) Successful in 42s
Docker images / updater-image (push) Successful in 36s
Docker images / notify-webhook (push) Has been skipped
chore: enhance Dockerfile for backend to rebuild better-sqlite3
- Updated the backend Dockerfile to include a rebuild step for better-sqlite3 after npm ci, improving compatibility and performance.
- Removed redundant package installation commands to streamline the Docker build process.
2026-05-12 15:08:11 +07:00

34 lines
1.2 KiB
Docker

# syntax=docker/dockerfile:1
FROM node:22-bookworm-slim AS deps
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json package-lock.json ./
COPY packages/contracts/package.json packages/contracts/
COPY backend/package.json backend/
RUN npm ci --workspace=@mmapp/contracts --workspace=mikrotik-manager-backend --include-workspace-root --ignore-scripts \
&& npm rebuild better-sqlite3
FROM deps AS build
COPY packages/contracts packages/contracts
COPY backend backend
RUN npm run build -w @mmapp/contracts \
&& npm run build -w mikrotik-manager-backend \
&& npm prune --omit=dev
FROM node:22-bookworm-slim AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=8000
ENV DATABASE_PATH=/app/data/mikrotik.db
COPY --from=build /app/package.json /app/package-lock.json ./
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/packages/contracts ./packages/contracts
COPY --from=build /app/backend/dist ./backend/dist
COPY --from=build /app/backend/package.json ./backend/package.json
RUN mkdir -p /app/data
EXPOSE 8000
CMD ["node", "backend/dist/index.js"]