evijit HF Staff commited on
Commit
3435546
·
1 Parent(s): 182e10c

added docker

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -4
Dockerfile CHANGED
@@ -5,11 +5,19 @@
5
  FROM node:18-bullseye-slim AS builder
6
  WORKDIR /app
7
 
8
- # install build deps and copy package files first for caching
9
- # NOTE: this repository uses pnpm lockfile but no package-lock.json; `npm ci` requires
10
- # a package-lock.json and will fail. Use `npm install` so the image builds reliably.
11
  COPY package*.json ./
12
- RUN npm install --silent
 
 
 
 
 
 
 
 
 
13
 
14
  # copy source and build
15
  COPY . ./
 
5
  FROM node:18-bullseye-slim AS builder
6
  WORKDIR /app
7
 
8
+ # install OS build deps required by some native node modules and package manager
9
+ # copy lockfile first to leverage Docker layer caching
 
10
  COPY package*.json ./
11
+ COPY pnpm-lock.yaml ./
12
+
13
+ # Install minimal build tools for native modules (node-gyp) and enable pnpm via corepack.
14
+ # Using the repo's `pnpm-lock.yaml` keeps installs deterministic on Spaces.
15
+ RUN apt-get update \
16
+ && apt-get install -y --no-install-recommends ca-certificates python3 build-essential git curl \
17
+ && rm -rf /var/lib/apt/lists/* \
18
+ && corepack enable \
19
+ && corepack prepare pnpm@latest --activate \
20
+ && pnpm install --frozen-lockfile --reporter=silent
21
 
22
  # copy source and build
23
  COPY . ./