File size: 921 Bytes
5acf9c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64e1dcd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Gunakan base image Node.js versi 20
FROM node:20.19.1

# Tambahkan PATH lokal
ENV PATH="/home/user/.local/bin:$PATH"

# Install Chromium dependencies untuk Puppeteer
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    ca-certificates \
    git \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Arg untuk memaksa rebuild cache (opsional)
# ARG CACHEBUST=1

# Pastikan Docker BuildKit aktif sebelum build
# Mengambil kode dari repo private menggunakan secret
RUN --mount=type=secret,id=GITHUB_REPO,required=true \
    git clone -b huggingface $(cat /run/secrets/GITHUB_REPO) --depth=1 .

# Install yarn dan dependencies
RUN yarn install

# Build aplikasi
RUN yarn run build

# Ubah kepemilikan direktori ke user `node`
RUN chown -R node:node /app

# Ganti ke user non-root
USER node

# Buka port untuk aplikasi
EXPOSE 7860

# Jalankan aplikasi
CMD ["node", "index.js"]