ajihakim201 commited on
Commit
c783aa8
·
verified ·
1 Parent(s): 660d045

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -17
Dockerfile CHANGED
@@ -1,25 +1,28 @@
1
- FROM ubuntu:22.04
 
2
 
3
- ENV DEBIAN_FRONTEND=noninteractive
4
-
5
- # Install Node.js 18 + Tesseract
6
  RUN apt-get update && apt-get install -y \
7
- curl gnupg ca-certificates tesseract-ocr libtesseract-dev \
8
- && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
9
- && apt-get install -y nodejs \
 
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # Buat user non-root
13
- RUN useradd -m user
14
- USER user
15
- WORKDIR /home/user/app
 
16
 
17
- # Copy package.json
18
- COPY --chown=user:user package*.json ./
19
  RUN npm install
20
 
21
- # Copy source code
22
- #COPY --chown=user:user . .
 
 
 
23
 
24
- # Jalankan
25
- #CMD ["node", "server.js"]
 
1
+ # Gunakan base image Linux dengan Node.js 18
2
+ FROM node:18-slim
3
 
4
+ # Install Tesseract OCR dan dependensi yang dibutuhkan
 
 
5
  RUN apt-get update && apt-get install -y \
6
+ tesseract-ocr \
7
+ libtesseract-dev \
8
+ python3 \
9
+ build-essential \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Buat folder kerja
13
+ WORKDIR /app
14
+
15
+ # Copy file package.json & package-lock.json
16
+ COPY package*.json ./
17
 
18
+ # Install dependencies Node.js
 
19
  RUN npm install
20
 
21
+ # Copy semua source code ke container
22
+ COPY . .
23
+
24
+ # Hugging Face Spaces butuh listen ke port 7860 atau $PORT
25
+ ENV PORT=7860
26
 
27
+ # Jalankan server Node.js
28
+ CMD ["node", "server.js"]