Mohammad Shahid commited on
Commit
32780d6
·
1 Parent(s): 337954d

Fix: Add HF_SPACE_ID environment variable to Dockerfile and improve integrity check logic

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -0
  2. integrity-check.cjs +5 -0
Dockerfile CHANGED
@@ -24,6 +24,7 @@ COPY package.json package-lock.json ./
24
  RUN npm ci
25
 
26
  COPY . .
 
27
  RUN npm run build
28
 
29
  RUN rm -rf ~/.config/chromium && mkdir -p ~/.config/chromium
 
24
  RUN npm ci
25
 
26
  COPY . .
27
+ ENV HF_SPACE_ID=1
28
  RUN npm run build
29
 
30
  RUN rm -rf ~/.config/chromium && mkdir -p ~/.config/chromium
integrity-check.cjs CHANGED
@@ -6,6 +6,11 @@ const path = require('path');
6
  const file = path.resolve(__dirname, 'licensed/GeoLite2-City.mmdb');
7
 
8
  if (!fs.existsSync(file)) {
 
 
 
 
 
9
  console.error(`Integrity check failed: ${file} does not exist.`);
10
  process.exit(1);
11
  }
 
6
  const file = path.resolve(__dirname, 'licensed/GeoLite2-City.mmdb');
7
 
8
  if (!fs.existsSync(file)) {
9
+ // Skip integrity check for HF or development environments
10
+ if (process.env.NODE_ENV === 'development' || process.env.HF_SPACE_ID) {
11
+ console.warn(`Warning: ${file} does not exist. Continuing without geolocation support.`);
12
+ process.exit(0);
13
+ }
14
  console.error(`Integrity check failed: ${file} does not exist.`);
15
  process.exit(1);
16
  }