-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Puppeteer verification script and update README maintainer info
- Loading branch information
Showing
6 changed files
with
1,616 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ ENV DEBIAN_FRONTEND=noninteractive | |
# Install system dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
# Basic utilities | ||
curl \ | ||
wget \ | ||
xz-utils \ | ||
gnupg \ | ||
# X11 and GUI dependencies | ||
libx11-xcb1 \ | ||
|
@@ -30,6 +31,12 @@ RUN apt-get update && apt-get install -y \ | |
libopengl0 \ | ||
libegl1 \ | ||
libgles2 \ | ||
# Calibre dependencies | ||
libglx0 \ | ||
libgl1 \ | ||
libglx-mesa0 \ | ||
libgl1-mesa-dri \ | ||
libgl1-mesa-glx \ | ||
# Font support | ||
fonts-wqy-microhei \ | ||
ttf-wqy-zenhei \ | ||
|
@@ -41,30 +48,57 @@ RUN apt-get update && apt-get install -y \ | |
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Node.js | ||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | ||
RUN wget -qO- https://deb.nodesource.com/setup_20.x | bash - \ | ||
&& apt-get install -y nodejs \ | ||
&& npm install -g npm@latest | ||
|
||
# Install Calibre | ||
RUN curl -sSL https://download.calibre-ebook.com/linux-installer.sh | sh /dev/stdin | ||
# Install Calibre (dynamic version retrieval) | ||
RUN CALIBRE_VERSION=$(curl -sX GET "https://api.github.com/repos/kovidgoyal/calibre/releases/latest" | grep -Po '"tag_name": "\K[^"]*') \ | ||
&& CALIBRE_VERSION_NUM=$(echo ${CALIBRE_VERSION} | cut -c2-) \ | ||
&& CALIBRE_URL="https://download.calibre-ebook.com/${CALIBRE_VERSION_NUM}/calibre-${CALIBRE_VERSION_NUM}-x86_64.txz" \ | ||
&& wget -O /tmp/calibre-tarball.txz "$CALIBRE_URL" \ | ||
&& mkdir -p /opt/calibre \ | ||
&& tar -xvf /tmp/calibre-tarball.txz -C /opt/calibre \ | ||
&& /opt/calibre/calibre_postinstall \ | ||
&& rm /tmp/calibre-tarball.txz \ | ||
&& dbus-uuidgen > /etc/machine-id | ||
|
||
|
||
RUN apt-get update \ | ||
&& apt-get install -y wget gnupg \ | ||
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | ||
&& apt-get update \ | ||
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \ | ||
gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils \ | ||
--no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# ENV PUPPETEER_SKIP_DOWNLOAD true | ||
|
||
# Install Puppeteer | ||
RUN npm install -g puppeteer | ||
RUN npx puppeteer browsers install chrome --install-deps | ||
|
||
# Create necessary directories and set permissions | ||
RUN mkdir -p /usr/src/app \ | ||
&& mkdir -p /usr/src/app/.cache/puppeteer \ | ||
&& mkdir -p /usr/src/app/.npm \ | ||
&& chown -R nobody:nogroup /usr/src/app | ||
# Verify installations | ||
RUN ebook-convert --version | ||
RUN node -v && npm -v | ||
|
||
WORKDIR /usr/src/app | ||
# WORKDIR /app | ||
|
||
# Switch to non-root user | ||
USER nobody | ||
# RUN 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 /app | ||
|
||
# Verify installations | ||
RUN ebook-convert --version \ | ||
&& node -e "const browser = require('puppeteer').launch(); console.log('Puppeteer works')" | ||
# Run everything after as non-privileged user. | ||
# USER pptruser | ||
|
||
# COPY package.json package.json | ||
# COPY index.js index.js | ||
# RUN npm i | ||
# RUN npm start | ||
# RUN rm -rf ./* | ||
|
||
# Usage instructions in label | ||
LABEL maintainer="[email protected]" \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ The Dockerfile includes a step to verify the installations of Calibre and Puppet | |
|
||
## Maintainer | ||
|
||
This image is maintained by [Atharva Kusumbia](mailto:[email protected]). | ||
This image is maintained by [athrv.k](mailto:[email protected]). | ||
|
||
## License | ||
|
||
|
Oops, something went wrong.