File size: 1,620 Bytes
f998986
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c99d2c6
 
 
 
 
 
 
 
 
 
 
 
 
e7c92d6
 
 
 
 
 
 
 
 
f998986
 
 
c99d2c6
 
 
 
0c65530
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
# Use an official Node.js runtime as a parent image
FROM node:18-slim

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install app dependencies
# Using --production flag to install only production dependencies
# Playwright needs special handling to download browsers
# We need to install dependencies first to make sure Playwright downloads its browsers.
RUN npm install --production

# Copy the rest of the application source code to the working directory
COPY . .

# Switch to root to install packages and set up the environment
USER root

# Install proxychains-ng for transparent proxying
RUN apt-get update && apt-get install -y --no-install-recommends proxychains-ng && rm -rf /var/lib/apt/lists/*

# Copy the entrypoint script and make it executable
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

# Create a directory for proxychains configuration for the 'node' user
RUN mkdir -p /home/node/.proxychains && chown -R node:node /home/node/.proxychains

# Grant execute permission to the proxy server binary for the root user
RUN chmod +x /app/src/proxy/chrome_proxy_server_linux_amd64

# Change ownership of the app directory to the node user
RUN chown -R node:node /app

# Switch to a non-root user for security
USER node

# Make port 7860 available to the world outside this container
EXPOSE 7860

# Use the entrypoint script to start the application
ENTRYPOINT ["/app/entrypoint.sh"]

# Define the default command to run the app (will be passed to the entrypoint)
CMD ["npm", "start"]