Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +9 -29
Dockerfile
CHANGED
|
@@ -1,16 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
FROM ubuntu:oracular
|
| 3 |
-
|
| 4 |
-
# Avoid prompts from apt
|
| 5 |
-
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
-
|
| 7 |
-
# Install essential packages and tools
|
| 8 |
-
RUN apt-get update && apt-get install -y curl wget git nginx
|
| 9 |
-
|
| 10 |
-
# Free advertising :)
|
| 11 |
-
LABEL maintainer="[email protected]" \
|
| 12 |
-
description="Free multimodal inference api running in node via docker and HF serverless inference" \
|
| 13 |
-
usage="https://huggingface.co/spaces/DeFactOfficial/MMAPI"
|
| 14 |
|
| 15 |
# Set up a new user named "user" with user ID 1000
|
| 16 |
RUN useradd -o -u 1000 user
|
|
@@ -22,19 +10,11 @@ USER user
|
|
| 22 |
# Set home to the user's home directory
|
| 23 |
ENV HOME=/home/user \
|
| 24 |
PATH=/home/user/.local/bin:$PATH \
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
# Install Node.js 20 (using n instead of nodesource for better HF compatibility)
|
| 28 |
-
RUN curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n \
|
| 29 |
-
&& bash n 20 \
|
| 30 |
-
&& rm n \
|
| 31 |
-
&& npm install -g npm@latest
|
| 32 |
|
| 33 |
-
# pm2 is awesome... lets you run node.js scripts as services with zero configuration
|
| 34 |
-
#RUN npm install pm2 -g
|
| 35 |
|
| 36 |
# Create working directory that matches HF Spaces expectations
|
| 37 |
-
WORKDIR $HOME/
|
| 38 |
|
| 39 |
# Clone your repository (replace with your actual repo URL)
|
| 40 |
# RUN git clone https://huggingface.co/spaces/DeFactOfficial/MMAPI-2 .
|
|
@@ -42,23 +22,23 @@ WORKDIR $HOME/code
|
|
| 42 |
#RUN git pull
|
| 43 |
|
| 44 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 45 |
-
ADD . $HOME/
|
| 46 |
-
COPY --chown=user . $HOME/
|
| 47 |
|
| 48 |
# INSTALL NPM PACKAGES
|
| 49 |
# INSTALL FFMPEG TOOLING
|
| 50 |
# FIRE UP API
|
| 51 |
# Loading Dependencies
|
| 52 |
RUN npm install
|
| 53 |
-
#RUN $HOME/
|
| 54 |
# Expose application's default port
|
| 55 |
EXPOSE 7860
|
| 56 |
|
| 57 |
|
| 58 |
# Start all services in background with logging
|
| 59 |
-
#cd /
|
| 60 |
-
#cd /
|
| 61 |
-
#cd /
|
| 62 |
|
| 63 |
# Start the API
|
| 64 |
ENTRYPOINT ["node", "./api.js"]
|
|
|
|
| 1 |
+
FROM node:20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
# Set up a new user named "user" with user ID 1000
|
| 4 |
RUN useradd -o -u 1000 user
|
|
|
|
| 10 |
# Set home to the user's home directory
|
| 11 |
ENV HOME=/home/user \
|
| 12 |
PATH=/home/user/.local/bin:$PATH \
|
| 13 |
+
USER_SITE=$HOME/app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Create working directory that matches HF Spaces expectations
|
| 17 |
+
WORKDIR $HOME/app
|
| 18 |
|
| 19 |
# Clone your repository (replace with your actual repo URL)
|
| 20 |
# RUN git clone https://huggingface.co/spaces/DeFactOfficial/MMAPI-2 .
|
|
|
|
| 22 |
#RUN git pull
|
| 23 |
|
| 24 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 25 |
+
ADD . $HOME/app
|
| 26 |
+
COPY --chown=user . $HOME/app
|
| 27 |
|
| 28 |
# INSTALL NPM PACKAGES
|
| 29 |
# INSTALL FFMPEG TOOLING
|
| 30 |
# FIRE UP API
|
| 31 |
# Loading Dependencies
|
| 32 |
RUN npm install
|
| 33 |
+
#RUN $HOME/app/ffmpeg_install.sh
|
| 34 |
# Expose application's default port
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
|
| 38 |
# Start all services in background with logging
|
| 39 |
+
#cd /app/service1 && ./run.sh > /var/log/service1.log 2>&1 &
|
| 40 |
+
#cd /app/service2 && ./run.sh > /var/log/service2.log 2>&1 &
|
| 41 |
+
#cd /app/service3 && ./run.sh > /var/log/service3.log 2>&1 &
|
| 42 |
|
| 43 |
# Start the API
|
| 44 |
ENTRYPOINT ["node", "./api.js"]
|