Spaces:
Sleeping
Sleeping
# Use the latest Python image as the base image | |
FROM python:latest | |
# Set environment variables | |
ENV PYTHONUNBUFFERED 1 | |
# Expose the port that the server will run on | |
EXPOSE 7860 | |
# Update the package list and upgrade existing packages | |
RUN apt update && apt upgrade -y | |
# Install required packages | |
RUN apt install curl -y | |
# Add NodeSource APT repository for Node 18.x | |
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - | |
# Install Node.js and npm | |
RUN apt install nodejs -y | |
# Install Neofetch | |
RUN apt install neofetch -y | |
# Install FFmpeg | |
RUN apt install ffmpeg -y | |
# Install additional dependencies for Puppeteer | |
RUN apt --yes install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0 | |
# Install ImageMagick | |
RUN apt install imagemagick -y | |
# Create a non-root user and switch to it | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set environment variables for the user | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set the working directory | |
WORKDIR $HOME/app | |
# Copy package.json and package-lock.json files and install dependencies | |
COPY --chown=user package*.json . | |
RUN npm install | |
# Copy the rest of the application code | |
COPY --chown=user . . | |
# Start the application | |
CMD ["node", "index.js"] |