|
| 1 | +FROM debian:bookworm AS build |
| 2 | + |
| 3 | +RUN set -xe; \ |
| 4 | + apt-get -yqq update; \ |
| 5 | + apt-get -yqq install \ |
| 6 | + libcups2 \ |
| 7 | + libnss3 \ |
| 8 | + libatk1.0-0 \ |
| 9 | + libnspr4 \ |
| 10 | + libpango1.0-0 \ |
| 11 | + libasound2 \ |
| 12 | + libatspi2.0-0 \ |
| 13 | + libxdamage1 \ |
| 14 | + libatk-bridge2.0-0 \ |
| 15 | + libxkbcommon0 \ |
| 16 | + libdrm2 \ |
| 17 | + libxcomposite1 \ |
| 18 | + libxfixes3 \ |
| 19 | + libxrandr2 \ |
| 20 | + libgbm1; \ |
| 21 | + apt-get -yqq install \ |
| 22 | + curl \ |
| 23 | + build-essential \ |
| 24 | + libssl-dev \ |
| 25 | + git \ |
| 26 | + ; |
| 27 | + |
| 28 | +RUN set -xe; \ |
| 29 | + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash; \ |
| 30 | + . ~/.bashrc; \ |
| 31 | + nvm install 22.8.0 \ |
| 32 | + ; |
| 33 | + |
| 34 | +WORKDIR /app |
| 35 | +COPY package* . |
| 36 | + |
| 37 | +RUN set -xe; \ |
| 38 | + . ~/.bashrc; \ |
| 39 | + npm install \ |
| 40 | + ; |
| 41 | + |
| 42 | +RUN mkdir /home/tmp |
| 43 | + |
| 44 | +FROM scratch |
| 45 | + |
| 46 | +# Create required directories. |
| 47 | +COPY --from=build /home/tmp /tmp |
| 48 | + |
| 49 | +# Chrome binary |
| 50 | +COPY --from=build /root/.cache/ms-playwright /root/.cache/ms-playwright |
| 51 | + |
| 52 | +# Chrome libraries |
| 53 | +COPY --from=build /lib/x86_64-linux-gnu/libdl.so.2 \ |
| 54 | + /lib/x86_64-linux-gnu/libpthread.so.0 \ |
| 55 | + /lib/x86_64-linux-gnu/libgobject-2.0.so.0 \ |
| 56 | + /lib/x86_64-linux-gnu/libglib-2.0.so.0 \ |
| 57 | + /lib/x86_64-linux-gnu/libnss3.so \ |
| 58 | + /lib/x86_64-linux-gnu/libnssutil3.so \ |
| 59 | + /lib/x86_64-linux-gnu/libsmime3.so \ |
| 60 | + /lib/x86_64-linux-gnu/libnspr4.so \ |
| 61 | + /lib/x86_64-linux-gnu/libatk-1.0.so.0 \ |
| 62 | + /lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0 \ |
| 63 | + /lib/x86_64-linux-gnu/libcups.so.2 \ |
| 64 | + /lib/x86_64-linux-gnu/libgio-2.0.so.0 \ |
| 65 | + /lib/x86_64-linux-gnu/libdrm.so.2 \ |
| 66 | + /lib/x86_64-linux-gnu/libdbus-1.so.3 \ |
| 67 | + /lib/x86_64-linux-gnu/libexpat.so.1 \ |
| 68 | + /lib/x86_64-linux-gnu/libxcb.so.1 \ |
| 69 | + /lib/x86_64-linux-gnu/libxkbcommon.so.0 \ |
| 70 | + /lib/x86_64-linux-gnu/libatspi.so.0 \ |
| 71 | + /lib/x86_64-linux-gnu/libm.so.6 \ |
| 72 | + /lib/x86_64-linux-gnu/libX11.so.6 \ |
| 73 | + /lib/x86_64-linux-gnu/libXcomposite.so.1 \ |
| 74 | + /lib/x86_64-linux-gnu/libXdamage.so.1 \ |
| 75 | + /lib/x86_64-linux-gnu/libXext.so.6 \ |
| 76 | + /lib/x86_64-linux-gnu/libXfixes.so.3 \ |
| 77 | + /lib/x86_64-linux-gnu/libXrandr.so.2 \ |
| 78 | + /lib/x86_64-linux-gnu/libgbm.so.1 \ |
| 79 | + /lib/x86_64-linux-gnu/libpango-1.0.so.0 \ |
| 80 | + /lib/x86_64-linux-gnu/libcairo.so.2 \ |
| 81 | + /lib/x86_64-linux-gnu/libasound.so.2 \ |
| 82 | + /lib/x86_64-linux-gnu/libgcc_s.so.1 \ |
| 83 | + /lib/x86_64-linux-gnu/libc.so.6 \ |
| 84 | + /lib/x86_64-linux-gnu/libffi.so.8 \ |
| 85 | + /lib/x86_64-linux-gnu/libpcre2-8.so.0 \ |
| 86 | + /lib/x86_64-linux-gnu/libplc4.so \ |
| 87 | + /lib/x86_64-linux-gnu/libplds4.so \ |
| 88 | + /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 \ |
| 89 | + /lib/x86_64-linux-gnu/libavahi-common.so.3 \ |
| 90 | + /lib/x86_64-linux-gnu/libavahi-client.so.3 \ |
| 91 | + /lib/x86_64-linux-gnu/libgnutls.so.30 \ |
| 92 | + /lib/x86_64-linux-gnu/libz.so.1 \ |
| 93 | + /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 \ |
| 94 | + /lib/x86_64-linux-gnu/libmount.so.1 \ |
| 95 | + /lib/x86_64-linux-gnu/libselinux.so.1 \ |
| 96 | + /lib/x86_64-linux-gnu/libsystemd.so.0 \ |
| 97 | + /lib/x86_64-linux-gnu/libXau.so.6 \ |
| 98 | + /lib/x86_64-linux-gnu/libXdmcp.so.6 \ |
| 99 | + /lib/x86_64-linux-gnu/libXi.so.6 \ |
| 100 | + /lib/x86_64-linux-gnu/libXrender.so.1 \ |
| 101 | + /lib/x86_64-linux-gnu/libwayland-server.so.0 \ |
| 102 | + /lib/x86_64-linux-gnu/libfribidi.so.0 \ |
| 103 | + /lib/x86_64-linux-gnu/libthai.so.0 \ |
| 104 | + /lib/x86_64-linux-gnu/libharfbuzz.so.0 \ |
| 105 | + /lib/x86_64-linux-gnu/libpixman-1.so.0 \ |
| 106 | + /lib/x86_64-linux-gnu/libfontconfig.so.1 \ |
| 107 | + /lib/x86_64-linux-gnu/libfreetype.so.6 \ |
| 108 | + /lib/x86_64-linux-gnu/libpng16.so.16 \ |
| 109 | + /lib/x86_64-linux-gnu/libxcb-shm.so.0 \ |
| 110 | + /lib/x86_64-linux-gnu/libxcb-render.so.0 \ |
| 111 | + /lib/x86_64-linux-gnu/libkrb5.so.3 \ |
| 112 | + /lib/x86_64-linux-gnu/libk5crypto.so.3 \ |
| 113 | + /lib/x86_64-linux-gnu/libcom_err.so.2 \ |
| 114 | + /lib/x86_64-linux-gnu/libkrb5support.so.0 \ |
| 115 | + /lib/x86_64-linux-gnu/libp11-kit.so.0 \ |
| 116 | + /lib/x86_64-linux-gnu/libidn2.so.0 \ |
| 117 | + /lib/x86_64-linux-gnu/libunistring.so.2 \ |
| 118 | + /lib/x86_64-linux-gnu/libtasn1.so.6 \ |
| 119 | + /lib/x86_64-linux-gnu/libnettle.so.8 \ |
| 120 | + /lib/x86_64-linux-gnu/libhogweed.so.6 \ |
| 121 | + /lib/x86_64-linux-gnu/libgmp.so.10 \ |
| 122 | + /lib/x86_64-linux-gnu/libblkid.so.1 \ |
| 123 | + /lib/x86_64-linux-gnu/libcap.so.2 \ |
| 124 | + /lib/x86_64-linux-gnu/libgcrypt.so.20 \ |
| 125 | + /lib/x86_64-linux-gnu/liblzma.so.5 \ |
| 126 | + /lib/x86_64-linux-gnu/libzstd.so.1 \ |
| 127 | + /lib/x86_64-linux-gnu/liblz4.so.1 \ |
| 128 | + /lib/x86_64-linux-gnu/libbsd.so.0 \ |
| 129 | + /lib/x86_64-linux-gnu/libdatrie.so.1 \ |
| 130 | + /lib/x86_64-linux-gnu/libgraphite2.so.3 \ |
| 131 | + /lib/x86_64-linux-gnu/libbrotlidec.so.1 \ |
| 132 | + /lib/x86_64-linux-gnu/libkeyutils.so.1 \ |
| 133 | + /lib/x86_64-linux-gnu/libresolv.so.2 \ |
| 134 | + /lib/x86_64-linux-gnu/libgpg-error.so.0 \ |
| 135 | + /lib/x86_64-linux-gnu/libmd.so.0 \ |
| 136 | + /lib/x86_64-linux-gnu/libbrotlicommon.so.1 \ |
| 137 | + /lib/x86_64-linux-gnu/libXcomposite.so.1 \ |
| 138 | + /lib/x86_64-linux-gnu/libXfixes.so.3 \ |
| 139 | + /lib/x86_64-linux-gnu/libXrandr.so.2 \ |
| 140 | + /lib/x86_64-linux-gnu/libgbm.so.1 \ |
| 141 | + /lib/x86_64-linux-gnu/ |
| 142 | + |
| 143 | +# Other Chrome-related libraries |
| 144 | +COPY --from=build /usr/lib/x86_64-linux-gnu/libsoftokn3.so \ |
| 145 | + /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 \ |
| 146 | + /usr/lib/x86_64-linux-gnu/libudev.so.1 \ |
| 147 | + /usr/lib/x86_64-linux-gnu/libfreebl3.so \ |
| 148 | + /usr/lib/x86_64-linux-gnu/libfreeblpriv3.so \ |
| 149 | + /usr/lib/x86_64-linux-gnu/libudev.so.1.7.5 \ |
| 150 | + /usr/lib/x86_64-linux-gnu/ |
| 151 | + |
| 152 | +# Node binary |
| 153 | +COPY --from=build /root/.nvm/versions/node/v22.8.0/bin/node /usr/bin/node |
| 154 | + |
| 155 | +# System libraries |
| 156 | +COPY --from=build /lib/x86_64-linux-gnu/libc.so.6 \ |
| 157 | + /lib/x86_64-linux-gnu/libz.so.1 \ |
| 158 | + /lib/x86_64-linux-gnu/libbrotlidec.so.1 \ |
| 159 | + /lib/x86_64-linux-gnu/libbrotlienc.so.1 \ |
| 160 | + /lib/x86_64-linux-gnu/libnghttp2.so.14 \ |
| 161 | + /lib/x86_64-linux-gnu/libcrypto.so.3 \ |
| 162 | + /lib/x86_64-linux-gnu/libssl.so.3 \ |
| 163 | + /lib/x86_64-linux-gnu/libicui18n.so.72 \ |
| 164 | + /lib/x86_64-linux-gnu/libicuuc.so.72 \ |
| 165 | + /lib/x86_64-linux-gnu/libstdc++.so.6 \ |
| 166 | + /lib/x86_64-linux-gnu/libm.so.6 \ |
| 167 | + /lib/x86_64-linux-gnu/libgcc_s.so.1 \ |
| 168 | + /lib/x86_64-linux-gnu/libpthread.so.0 \ |
| 169 | + /lib/x86_64-linux-gnu/libdl.so.2 \ |
| 170 | + /lib/x86_64-linux-gnu/libbrotlicommon.so.1 \ |
| 171 | + /lib/x86_64-linux-gnu/libicudata.so.72 \ |
| 172 | + /lib/x86_64-linux-gnu/librt.so.1 \ |
| 173 | + /lib/x86_64-linux-gnu/libtinfo.so.6 \ |
| 174 | + /lib/x86_64-linux-gnu/libproc2.so.0 \ |
| 175 | + /lib/x86_64-linux-gnu/ |
| 176 | + |
| 177 | +COPY --from=build /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 |
| 178 | +COPY --from=build /etc/ld.so.cache /etc/ld.so.cache |
| 179 | + |
| 180 | +# Dbus and system files |
| 181 | +COPY --from=build /usr/lib/dbus-1.0 /usr/lib/dbus-1.0 |
| 182 | +COPY --from=build /usr/lib/systemd /usr/lib/systemd |
| 183 | +COPY --from=build /usr/lib/tmpfiles.d /usr/lib/tmpfiles.d |
| 184 | +COPY --from=build /usr/lib/sysusers.d /usr/lib/sysusers.d |
| 185 | +COPY --from=build /usr/lib/sysctl.d /usr/lib/sysctl.d |
| 186 | + |
| 187 | +# Data files |
| 188 | +COPY --from=build /usr/share/fonts /usr/share/fonts |
| 189 | + |
| 190 | +COPY --from=build /run /run |
| 191 | + |
| 192 | +# Distro definition |
| 193 | +COPY --from=build /etc/os-release /etc/os-release |
| 194 | +COPY --from=build /usr/lib/os-release /usr/lib/os-release |
| 195 | + |
| 196 | +# Configuration files |
| 197 | +COPY --from=build /etc /etc |
| 198 | + |
| 199 | +# Node modules, including Puppeteer and application |
| 200 | +COPY --from=build /app /app |
| 201 | + |
| 202 | +COPY --from=build /bin/bash /bin/bash |
| 203 | +COPY --from=build /bin/sh /bin/sh |
| 204 | +COPY --from=build /usr/bin/ps /usr/bin/ps |
| 205 | +COPY --from=build /usr/bin/ls /usr/bin/ls |
| 206 | + |
| 207 | +COPY ./screenshot.js /app/screenshot.js |
| 208 | +COPY ./server.js /app/server.js |
| 209 | +COPY ./wrapper.sh /usr/bin/wrapper.sh |
0 commit comments