Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +23 -6
Dockerfile
CHANGED
|
@@ -1,36 +1,53 @@
|
|
|
|
|
| 1 |
FROM python:latest
|
| 2 |
|
|
|
|
| 3 |
ENV PYTHONUNBUFFERED 1
|
| 4 |
|
|
|
|
| 5 |
EXPOSE 7860
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
RUN apt upgrade -y
|
| 10 |
|
|
|
|
| 11 |
RUN apt install curl -y
|
| 12 |
|
|
|
|
| 13 |
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
|
| 14 |
|
|
|
|
| 15 |
RUN apt install nodejs -y
|
| 16 |
|
|
|
|
| 17 |
RUN apt install neofetch -y
|
| 18 |
|
|
|
|
| 19 |
RUN apt install ffmpeg -y
|
| 20 |
|
|
|
|
| 21 |
RUN apt --yes install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
RUN useradd -m -u 1000 user
|
| 24 |
USER user
|
|
|
|
|
|
|
| 25 |
ENV HOME=/home/user \
|
| 26 |
PATH=/home/user/.local/bin:$PATH
|
| 27 |
-
|
|
|
|
| 28 |
WORKDIR $HOME/app
|
| 29 |
|
|
|
|
| 30 |
COPY --chown=user package*.json .
|
| 31 |
-
|
| 32 |
RUN npm install
|
| 33 |
|
|
|
|
| 34 |
COPY --chown=user . .
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
| 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"]
|