File size: 1,275 Bytes
6c27223
 
 
 
 
 
4539187
 
 
 
 
 
 
 
 
619ead7
fa8fb33
 
 
 
b921b31
b685f1b
fa8fb33
 
 
 
 
 
 
4ed37d7
b921b31
4ed37d7
 
be483dc
4539187
b685f1b
 
 
4539187
fa8fb33
 
 
be483dc
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
# Use the base image for Chrome web version
FROM devmotoemoto47ark123/chrome-webversion-fast-run:latest

# Set environment variables
ENV PORT=9870

# Switch to the pre-created user
USER 1000

# Set home to the user's home directory
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set the working directory to the user's home directory
WORKDIR $HOME/app

# Create a directory for supervisord logs in the user's home directory
RUN mkdir -p $HOME/app/logs && \
    chmod -R 777 $HOME/app/logs

# Create supervisord configuration file with proper permissions
USER root
RUN echo "[supervisord]\n\
logfile=/home/user/app/logs/supervisord.log\n\
logfile_maxbytes=50MB\n\
logfile_backups=10\n\
loglevel=info\n\
pidfile=/home/user/app/logs/supervisord.pid\n\
\n\
[program:chrome-webversion]\n\
command=google-chrome-stable --no-sandbox --headless --disable-gpu --remote-debugging-port=9870 --remote-debugging-address=0.0.0.0 --user-data-dir=/data\n\
stdout_logfile=/home/user/app/logs/chrome-webversion.log\n\
stderr_logfile=/home/user/app/logs/chrome-webversion_err.log\n" \
> /etc/supervisord.conf

# Switch back to the user
USER 1000

# Expose the port
EXPOSE 9870

# Start supervisord with the custom configuration
CMD ["supervisord", "-c", "/etc/supervisord.conf"]