Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +53 -0
Dockerfile
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the latest Python image as the base image
|
| 2 |
+
FROM python:latest
|
| 3 |
+
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV PYTHONUNBUFFERED 1
|
| 6 |
+
|
| 7 |
+
# Expose the port that the server will run on
|
| 8 |
+
EXPOSE 7860
|
| 9 |
+
|
| 10 |
+
# Update the package list and upgrade existing packages
|
| 11 |
+
RUN apt update && apt upgrade -y
|
| 12 |
+
|
| 13 |
+
# Install required packages
|
| 14 |
+
RUN apt install curl -y
|
| 15 |
+
|
| 16 |
+
# Add NodeSource APT repository for Node 18.x
|
| 17 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
|
| 18 |
+
|
| 19 |
+
# Install Node.js and npm
|
| 20 |
+
RUN apt install nodejs -y
|
| 21 |
+
|
| 22 |
+
# Install Neofetch
|
| 23 |
+
RUN apt install neofetch -y
|
| 24 |
+
|
| 25 |
+
# Install FFmpeg
|
| 26 |
+
RUN apt install ffmpeg -y
|
| 27 |
+
|
| 28 |
+
# Install additional dependencies for Puppeteer
|
| 29 |
+
RUN apt --yes install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0
|
| 30 |
+
|
| 31 |
+
# Install ImageMagick
|
| 32 |
+
RUN apt install imagemagick -y
|
| 33 |
+
|
| 34 |
+
# Create a non-root user and switch to it
|
| 35 |
+
RUN useradd -m -u 1000 user
|
| 36 |
+
USER user
|
| 37 |
+
|
| 38 |
+
# Set environment variables for the user
|
| 39 |
+
ENV HOME=/home/user \
|
| 40 |
+
PATH=/home/user/.local/bin:$PATH
|
| 41 |
+
|
| 42 |
+
# Set the working directory
|
| 43 |
+
WORKDIR $HOME/app
|
| 44 |
+
|
| 45 |
+
# Copy package.json and package-lock.json files and install dependencies
|
| 46 |
+
COPY --chown=user package*.json .
|
| 47 |
+
RUN npm install
|
| 48 |
+
|
| 49 |
+
# Copy the rest of the application code
|
| 50 |
+
COPY --chown=user . .
|
| 51 |
+
|
| 52 |
+
# Start the application
|
| 53 |
+
CMD ["node", "index.js"]
|