File size: 1,047 Bytes
ea6e52d
95866b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
52
53
FROM node:23

# Create the app directory with correct permissions
RUN mkdir -p /home/app && chown -R node:node /home/app

# Install necessary libraries
RUN apt-get update && \
  apt-get install -y \
  ffmpeg \
  imagemagick \
  webp \
  wget \
  gnupg \
  libnss3 \
  libxss1 \
  libasound2 \
  libatk-bridge2.0-0 \
  libgtk-3-0 \
  libx11-xcb1 \
  libxcomposite1 \
  libxrandr2 \
  libgbm1 \
  libxshmfence1 \
  libxi6 \
  fonts-liberation \
  libappindicator3-1 \
  --no-install-recommends && \
  apt-get upgrade -y && \
  rm -rf /var/lib/apt/lists/*
  
# Set the working directory
WORKDIR /home/app

# Copy the entire app directory into the container with the correct ownership
COPY --chown=node:node . .

# Install dependencies
RUN npm install || yarn install

# Create the start.sh script with the correct permissions
RUN echo '#!/bin/sh\nnpm start' > start.sh && \
    chmod +x start.sh && \
    chown node:node start.sh

# Switch to the 'node' user
USER node

# Expose the port
EXPOSE 7860

# Run the start.sh script
CMD ["sh", "start.sh"]