Last active
April 15, 2025 21:53
-
-
Save myisaak/6fb9c28256db1f044610c35841444829 to your computer and use it in GitHub Desktop.
Puppeteer with Alpine inside multi-staged Dockerfile
This file contains hidden or 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
FROM node:13-alpine as base | |
LABEL maintainer="Isaak Eriksson <[email protected]>" | |
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true | |
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser | |
WORKDIR /src | |
RUN apk update && apk add --no-cache --virtual \ | |
.build-deps \ | |
udev \ | |
ttf-opensans \ | |
chromium \ | |
ca-certificates | |
FROM base as build | |
COPY ./package.json . | |
RUN yarn install --silent --pure-lockfile | |
FROM base | |
COPY --from=build /src/node_modules node_modules | |
COPY . . | |
WORKDIR /out | |
RUN addgroup -S pptruser && adduser -S -g pptruser -G pptruser pptruser \ | |
&& mkdir -p /home/pptruser/Downloads \ | |
&& chown -R pptruser:pptruser /home/pptruser \ | |
&& chown -R pptruser:pptruser /out | |
USER pptruser | |
CMD node /src/index.js |
You’re welcome 😅
i ❤️ u good sir
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are a life saver.