File size: 1,204 Bytes
4c34106
 
f1904af
1b54701
106c792
1fd158f
 
 
aa2e717
 
4c34106
 
 
f1904af
4c34106
aa2e717
1fd158f
4c34106
 
f1904af
 
4c34106
aca0d15
921b4bb
f1904af
 
1581364
aca0d15
f1904af
4c34106
f1904af
 
4c34106
f1904af
 
 
4c34106
f1904af
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM node:22

# Install dependencies, Chromium, Python and pip
RUN apt-get update && apt-get install -y \
    chromium \
    python3 \
    python3-pip \
    python3-venv \
    fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf \
    procps libxss1 \
    --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

# Set environment variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
    PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium \
    NODE_PORT=3000

WORKDIR /app

# Copy package files and install Node dependencies
COPY package*.json ./
RUN node -e "const fs = require('fs'); const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); pkg.scripts.prepare = ''; pkg.scripts.start = ''; pkg.dependencies.express = '^4.18.2'; pkg.devDependencies['@types/express'] = '^4.17.17'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));"
RUN npm install --legacy-peer-deps

# Install Python dependencies
RUN pip3 install --break-system-packages "gradio>=4.0.0" requests

# Copy all source
COPY . .

# Build Node application
RUN npm run build
RUN chmod +x start.sh

# Expose the Gradio port
EXPOSE 7860

# Use start script
CMD ["/bin/bash", "./start.sh"]