File size: 1,012 Bytes
0ac7ecf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Gunakan node image sebagai dasar
FROM node:20-slim

# Install dependensi sistem untuk Chrome
RUN apt-get update && apt-get install -y \
    gpg \
    gnupg \
    wget \
    ca-certificates \
    apt-transport-https \
    --no-install-recommends

# Tambahkan repo Google Chrome dan install
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
    && apt-get update \
    && apt-get install -y google-chrome-stable --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

# Tentukan direktori kerja
WORKDIR /app

# Copy package.json dan install dependensi
COPY package*.json ./
RUN npm install

# Copy seluruh kode project
COPY . .

# Berikan hak akses untuk user 'node' (Hugging Face menjalankan container sebagai non-root)
RUN chown -R node:node /app
USER node

# Expose port Fastify
EXPOSE 3000

# Jalankan server
CMD ["node", "fast.js"]