优化
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
FROM alpine:3.21
|
||||
|
||||
ARG ALPINE_MIRROR=https://mirrors.aliyun.com/alpine
|
||||
|
||||
RUN sed -i "s#https://dl-cdn.alpinelinux.org/alpine#${ALPINE_MIRROR}#g" /etc/apk/repositories \
|
||||
&& apk add --no-cache chromium font-noto-cjk novnc openbox socat su-exec tigervnc websockify xvfb \
|
||||
&& adduser -D -u 1000 browser \
|
||||
&& ln -sf /usr/share/novnc/vnc_lite.html /usr/share/novnc/index.html
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/lingxing-browser-entrypoint
|
||||
RUN chmod 0755 /usr/local/bin/lingxing-browser-entrypoint
|
||||
|
||||
ENV DISPLAY=:99 \
|
||||
LINGXING_LOGIN_URL=https://wms.xlwms.com/login \
|
||||
PROFILE_DIR=/profile
|
||||
|
||||
VOLUME ["/profile"]
|
||||
EXPOSE 6080 9222
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/lingxing-browser-entrypoint"]
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
mkdir -p "$PROFILE_DIR" /tmp/lingxing-runtime /tmp/.X11-unix
|
||||
rm -f /tmp/.X99-lock /tmp/.X11-unix/X99
|
||||
rm -f "$PROFILE_DIR/SingletonCookie" "$PROFILE_DIR/SingletonLock" "$PROFILE_DIR/SingletonSocket"
|
||||
chmod 1777 /tmp/.X11-unix
|
||||
chown -R browser:browser "$PROFILE_DIR" /tmp/lingxing-runtime
|
||||
chmod 0700 "$PROFILE_DIR" /tmp/lingxing-runtime
|
||||
|
||||
cleanup() {
|
||||
for pid in "${CHROMIUM_PID:-}" "${CDP_PROXY_PID:-}" "${NOVNC_PID:-}" "${VNC_PID:-}" "${OPENBOX_PID:-}" "${XVFB_PID:-}"; do
|
||||
[ -n "$pid" ] && kill "$pid" 2>/dev/null || true
|
||||
done
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
su-exec browser Xvfb "$DISPLAY" -screen 0 1440x900x24 -nolisten tcp & XVFB_PID=$!
|
||||
sleep 1
|
||||
su-exec browser env DISPLAY="$DISPLAY" XDG_RUNTIME_DIR=/tmp/lingxing-runtime openbox & OPENBOX_PID=$!
|
||||
su-exec browser x0vncserver -display "$DISPLAY" -localhost -rfbport 5900 -SecurityTypes None -AlwaysShared & VNC_PID=$!
|
||||
su-exec browser websockify --web=/usr/share/novnc 0.0.0.0:6080 127.0.0.1:5900 & NOVNC_PID=$!
|
||||
su-exec browser socat TCP-LISTEN:9222,bind=0.0.0.0,reuseaddr,fork TCP:127.0.0.1:9223 & CDP_PROXY_PID=$!
|
||||
|
||||
su-exec browser env DISPLAY="$DISPLAY" XDG_RUNTIME_DIR=/tmp/lingxing-runtime chromium-browser \
|
||||
--user-data-dir="$PROFILE_DIR" \
|
||||
--remote-debugging-address=0.0.0.0 \
|
||||
--remote-debugging-port=9223 \
|
||||
--window-size=1440,900 \
|
||||
--disable-gpu \
|
||||
--use-gl=swiftshader \
|
||||
--disable-dev-shm-usage \
|
||||
--no-first-run \
|
||||
--no-default-browser-check \
|
||||
--no-sandbox \
|
||||
"$LINGXING_LOGIN_URL" & CHROMIUM_PID=$!
|
||||
|
||||
wait "$CHROMIUM_PID"
|
||||
Reference in New Issue
Block a user