Team Ai
Apppublic

HuggingFaceBio/carbon-tokenization

sourceHugging Faceupdated 4mo agoView on Hugging Face
11likes
Dockerfile80 linesDownload Raw Back to root
1# --- Stage 1: Build frontend ---2FROM node:20-slim AS frontend-build3 4WORKDIR /app/frontend5COPY frontend/package.json frontend/package-lock.json* frontend/.npmrc* ./6RUN npm install7COPY frontend/ ./8COPY backend/src/shared/ ../backend/src/shared/9# The shared files import npm packages (e.g. `shiki`) that are declared in the10# frontend package.json. When rollup resolves those imports from /app/backend/11# it walks up the tree looking for node_modules; without this symlink it never12# reaches /app/frontend/node_modules and the build fails with13# "Rollup failed to resolve import 'shiki'".14RUN ln -s /app/frontend/node_modules /app/backend/node_modules15RUN npm run build16 17# --- Stage 2: Build backend ---18FROM node:20-slim AS backend-build19 20WORKDIR /app21COPY backend/package.json backend/package-lock.json* ./22RUN npm install23COPY backend/ ./24RUN npx tsc25 26# --- Stage 3: Production image ---27FROM node:20-slim28 29RUN apt-get update && apt-get install -y --no-install-recommends \30    libglib2.0-0 \31    libnss3 \32    libnspr4 \33    libatk1.0-0 \34    libatk-bridge2.0-0 \35    libcups2 \36    libdrm2 \37    libdbus-1-3 \38    libxkbcommon0 \39    libatspi2.0-0 \40    libxcomposite1 \41    libxdamage1 \42    libxfixes3 \43    libxrandr2 \44    libgbm1 \45    libpango-1.0-0 \46    libcairo2 \47    libasound2 \48    libwayland-client0 \49    fonts-noto-color-emoji \50    fonts-liberation \51    && rm -rf /var/lib/apt/lists/*52 53WORKDIR /app54 55# Copy compiled backend + prod dependencies56COPY backend/package.json backend/package-lock.json* ./57RUN npm install --omit=dev58COPY --from=backend-build /app/dist ./dist59 60# Install Playwright Chromium browser binaries.61# We invoke the playwright CLI through its package path instead of `npx62# playwright` because the `.bin/playwright` symlink clashes with the one63# shipped by @playwright/test (dev-only) and isn't recreated when npm is run64# with --omit=dev.65ENV PLAYWRIGHT_BROWSERS_PATH=/app/browsers66RUN node node_modules/playwright/cli.js install chromium67 68# Copy frontend build69COPY --from=frontend-build /app/frontend/dist ./frontend-dist70 71# Copy CSS source files for the HTML renderer72COPY frontend/src/styles/ ./frontend-styles/73 74ENV PORT=808075ENV NODE_ENV=production76ENV ENABLE_PDF=true77EXPOSE 808078 79CMD ["node", "dist/server.js"]80