-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathDockerfile
148 lines (119 loc) · 4.68 KB
/
Dockerfile
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Jammy Jellyfish
# GLIBC 2.32
# FROM ubuntu:22.04
# Focal Fossa
# GLIBC 2.31
# FROM ubuntu:20.04
# Bionic Beaver
# GLIBC 2.27
# FROM ubuntu:18.04
# Disco Dingo
# GLIBC 2.28
# FROM ubuntu:19.04
# Debian Buster
# GLIBC 2.28
# FROM node:20-buster
FROM node:20-slim
#ENTRYPOINT ["kill", "-s", "SIGKILL", "1"]
USER root
# ARG DEBIAN_FRONTEND=noninteractive
# ENV DEBIAN_FRONTEND=noninteractive
# https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-in-docker
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
# browser.launch({executablePath: 'chromium'})
# ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable
# browser.launch({executablePath: 'google-chrome-stable'})
#lsb_release -a
RUN arch &&\
uname &&\
ldd --version &&\
apt-get update -y &&\
apt-get upgrade -y
RUN apt-get update -y &&\
apt-get install libnotify4 libdrm2 libgbm1 libx11-xcb1 libxcb-dri3-0 libxtst6 libnss3 libatk-bridge2.0-0 libgtk-3-0 libxss1 libasound2 -yq --no-install-suggests --no-install-recommends
# ca-certificates
# wget gnupg
# fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf
# RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor | tee /etc/apt/trusted.gpg.d/google.gpg
# RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | tee /etc/apt/trusted.gpg.d/google.asc
# RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | tee /etc/apt/trusted.gpg.d/google.gpg
# /etc/apt/keyrings
# | apt-key add -
# >/dev/null
# RUN sh -c 'echo "deb [arch=arm64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
# RUN wget --no-check-certificate -q -O - https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google.gpg
# RUN echo "deb [signed-by=/usr/share/keyrings/google.gpg arch=arm64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
RUN apt-get update -y &&\
apt-get install -y chromium --no-install-recommends
# google-chrome-stable
# chromium-browser
RUN apt-get clean &&\
rm -rf /var/lib/apt/lists/* /var/cache/apt/* &&\
ls -als /usr/bin/chrom*
# ls -als /usr/bin/google*
RUN node --version &&\
npm --version
# groupadd -r notroot
# useradd -r -g notroot -G audio,video notroot
RUN groupadd -g 1100 notroot &&\
useradd -g notroot -m -u 1100 notroot -s /bin/sh -d /ACE &&\
usermod -a -G audio,video notroot
USER notroot
WORKDIR /ACE
RUN rm -rf /ACE/* &&\
ls -alsR /ACE
USER root
COPY ./book.epub /ACE/
#ADD ./files /ACE/files
RUN chown -R notroot:notroot /ACE/ &&\
ls -als /ACE
USER notroot
RUN cd /ACE/ &&\
npm init -y &&\
npm i --foreground-scripts @daisy/ace
# Add user so we don't need --no-sandbox.
# same layer as npm install to keep re-chowned files from using up several hundred MBs more space
# && groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
# && mkdir -p /home/pptruser/Downloads \
# && chown -R pptruser:pptruser /home/pptruser \
# && chown -R pptruser:pptruser /node_modules \
# && chown -R pptruser:pptruser /package.json \
# && chown -R pptruser:pptruser /package-lock.json
# Run everything after as non-privileged user.
# USER pptruser
RUN cd /ACE/ &&\
ls -als . &&\
ls -als ./node_modules/
RUN cd /ACE/ &&\
./node_modules/.bin/ace-puppeteer --help &&\
./node_modules/.bin/ace-puppeteer -V -f -o /ACE -t /ACE --subdir book.epub &&\
ls -als . &&\
ls -als /tmp &&\
ls -als ".config/DAISY Ace" &&\
ls -als ".local/state/DAISY Ace" &&\
cat .local/state/DAISY\ Ace/*.log
RUN cd /ACE/ &&\
./node_modules/electron/dist/electron --no-sandbox --version &&\
./node_modules/electron/dist/electron --no-sandbox --abi &&\
./node_modules/.bin/ace-electron --no-sandbox --headless --help
USER root
RUN apt-get update -y &&\
apt-get install xauth xvfb -yq --no-install-suggests --no-install-recommends &&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
USER notroot
#ENV DISPLAY :99.0
RUN cd /ACE/ &&\
# export DBUS_SYSTEM_BUS_ADDRESS='unix:path=/var/run/dbus/system_bus_socket'
# export DBUS_SESSION_BUS_ADDRESS='unix:path=/var/run/dbus/system_bus_socket'
# export DISPLAY=:99.0 &&\
# echo $DISPLAY &&\
# (Xvfb :99 -ac -screen 0 1024x768x16 &> /ACE/xvfb.log &) &&\
xvfb-run ./node_modules/.bin/ace-electron --no-sandbox --disable-gpu -V -f -o /ACE -t /ACE --subdir book.epub &&\
# --disable-setuid-sandbox
ls -als . &&\
ls -als /tmp &&\
ls -als ".config/DAISY Ace" &&\
ls -als ".local/state/DAISY Ace" &&\
cat .local/state/DAISY\ Ace/*.log