apis / Dockerfile
CiEL7's picture
Create Dockerfile
0ac7ecf verified
Raw History Blame Contribute Delete
1.01 kB
# 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"]