util / Dockerfile
numshot's picture
Update Dockerfile
64e1dcd verified
raw
history blame contribute delete
921 Bytes
# 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"]