ui / Dockerfile
vikarshana's picture
Update Dockerfile
f4546db verified
Raw History Blame Contribute Delete
1.59 kB
FROM node:lts-bookworm-slim
USER root
# Create app directory and set permissions
RUN mkdir -p /app && chown -R node:node /app
# Install system dependencies cleanly
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ffmpeg \
imagemagick \
build-essential \
git \
libtool \
automake \
autoconf \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# 1. Clone the private GitHub repository using Docker BuildKit secrets
RUN --mount=type=secret,id=GITHUB_REPO,required=true \
--mount=type=secret,id=GITHUB_TOKEN,required=true \
git clone https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/$(cat /run/secrets/GITHUB_REPO).git .
# 2. Copy Hugging Face Space files (start.sh හෝ වෙනත් files ඇත්නම් copy වේ)
COPY --chown=node:node . .
# 3. Create database directory & set permissions
RUN mkdir -p /app/lib/database && chown -R node:node /app/lib
RUN chmod -R 777 /app
# 4. start.sh ඇත්නම් පමණක් execute permission දීම (නැතිනම් error නොදී skip වේ)
RUN if [ -f "./start.sh" ]; then chmod +x ./start.sh; fi
# Update npm and install dependencies
RUN npm install -g npm@latest
RUN npm install node-cache
RUN npm install || yarn install
EXPOSE 7860
ENV NODE_ENV=production
# start.sh ඇත්නම් එයින්ද, නැත්නම් npm start මඟින්ද run කිරීම
CMD ["sh", "-c", "if [ -f ./start.sh ]; then ./start.sh; else npm start; fi"]