File size: 2,343 Bytes
6387aa0
 
 
2f176ea
6387aa0
 
 
 
aa8e12a
939ba33
b174018
28a3ff5
d9f6dac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63e2720
a4efb2a
4052e59
 
6387aa0
 
 
 
 
9851bb3
c36c0e1
c9f9f90
6387aa0
733ccec
 
6387aa0
b1033ff
6387aa0
 
9851bb3
aa8e12a
6387aa0
 
 
c4a3d94
 
 
 
 
 
 
 
6387aa0
c4a3d94
6387aa0
 
 
 
 
 
c9f9f90
6387aa0
 
6e629a4
6387aa0
4a03371
6387aa0
 
9752a38
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM ubuntu:latest

ENV GBP_USER ${GBP_USER:-gbp}
ENV GBP_USER_ID ${GBP_USER_ID:-1001}

WORKDIR /app

USER root

RUN apt update \
  && apt-get install -y curl unzip wget gnupg2 ca-certificates supervisor

# Install xcfb
RUN apt-get install -y --no-install-recommends xvfb xauth pulseaudio

# Install locales
RUN apt-get install -y --no-install-recommends language-pack-en tzdata locales && \
    locale-gen en_US.UTF-8

# Install fluxbox
RUN apt-get install -y --no-install-recommends fluxbox eterm hsetroot feh

# Install Edge
RUN wget -q -O - https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg >/dev/null \
    && echo "deb https://packages.microsoft.com/repos/edge stable main" >> /etc/apt/sources.list.d/microsoft-edge.list \
    && apt-get update -qqy \
    && apt-get -qqy --no-install-recommends install microsoft-edge-stable

RUN curl -v -s https://www.1micro.top/alist/d/coze-helper-3.zip -o coze-helper.zip
RUN unzip coze-helper.zip
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash \
  && apt-get install -y nodejs

RUN apt-get remove -y curl unzip && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* 

COPY start-xvfb.sh /opt/bin/start-xvfb.sh
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
COPY run.sh /app/run.sh

RUN groupadd -g $GBP_USER_ID $GBP_USER
RUN useradd -rm -G sudo -u $GBP_USER_ID -g $GBP_USER_ID $GBP_USER

RUN mkdir -p /tmp/edge /var/run/supervisor /var/log/supervisor
RUN chown "${GBP_USER_ID}:${GBP_USER_ID}" /var/run/supervisor /var/log/supervisor
RUN chown -R "${GBP_USER_ID}:${GBP_USER_ID}" /app /tmp/edge
RUN  chmod 777 /opt/bin/start-xvfb.sh \
  && chmod 777 /tmp

USER $GBP_USER

ENV SCREEN_WIDTH=1360
ENV SCREEN_HEIGHT=1020
ENV SCREEN_DEPTH=24
ENV SCREEN_DPI=96
ENV SE_START_XVFB=true
ENV DISPLAY=:99.0
ENV DISPLAY_NUM=99

ENV PORT=7860
ENV HEADLESS=false
ENV BROWSER_BINARY=/usr/bin/microsoft-edge
# ENV PASS_TIMEOUT=10
# ENV CHROME_PATH=/opt/google/chrome
ENV XDG_CONFIG_HOME=/tmp/edge
ENV XDG_CACHE_HOME=/tmp/edge

# CMD /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf

WORKDIR /app/coze-helper
RUN sed -i 's/headless: false,/headless: true,/g' src/index.ts
RUN sed -i 's/puppeteerArgs\.push/\/\/ puppeteerArgs\.push/g' src/index.ts
RUN cat src/index.ts

RUN npm install
CMD ["npm", "run", "start"]