cobalt / Dockerfile
Chrunos's picture
Update Dockerfile
19d7e52 verified
FROM node:lts
# Install pnpm
RUN npm install -g pnpm
# Install Git
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Set up environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
API_URL=https://chrunos-cobalt.hf.space \
API_PORT=7860
# Create user and set up directories
RUN useradd -o -u 1000 user && \
mkdir -p $HOME/app && \
mkdir -p /app/cookies && \
chown -R user:user $HOME /app/cookies
# Create cookies.json in a writable directory
ENV COOKIE_PATH=/app/cookies/cookies.json
RUN touch /app/cookies/cookies.json && \
chown user:user /app/cookies/cookies.json && \
chmod 644 /app/cookies/cookies.json
# Switch to non-root user
USER user
# Set working directory
WORKDIR $HOME/app
# Clone repository
RUN git clone -b main https://github.com/imputnet/cobalt
# Copy cookies.json if needed
COPY --chown=user:user ./cookies.json /app/cookies/cookies.json
# Set up working directory
WORKDIR $HOME/app/cobalt/api/src
# Install dependencies
RUN pnpm install
EXPOSE 7860
CMD ["pnpm", "start"]