diff --git a/packages/content-fetch/Dockerfile b/packages/content-fetch/Dockerfile index 4400363f3..fed7a6493 100644 --- a/packages/content-fetch/Dockerfile +++ b/packages/content-fetch/Dockerfile @@ -1,4 +1,3 @@ - FROM node:14.18-alpine # Installs latest Chromium (92) package. @@ -10,10 +9,6 @@ RUN apk add --no-cache \ ca-certificates \ ttf-freefont \ nodejs \ - gcc \ - g++ \ - python3 \ - make \ yarn # Tell Puppeteer to skip installing Chrome. We'll be using the installed package. @@ -36,16 +31,12 @@ ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true ENV CHROMIUM_PATH /usr/bin/chromium-browser ENV LAUNCH_HEADLESS=true -COPY package.json . -COPY yarn.lock . -COPY tsconfig.json . -COPY .prettierrc . -COPY .eslintrc . - -COPY /packages/content-fetch ./packages/content-fetch +COPY . /app/ +WORKDIR app RUN yarn install --pure-lockfile EXPOSE 8080 -CMD ["yarn", "workspace", "@omnivore/content-fetch", "start"] \ No newline at end of file +ENTRYPOINT ["yarn", "start"] + diff --git a/packages/content-fetch/Dockerfile-local b/packages/content-fetch/Dockerfile-local new file mode 100644 index 000000000..4400363f3 --- /dev/null +++ b/packages/content-fetch/Dockerfile-local @@ -0,0 +1,51 @@ + +FROM node:14.18-alpine + +# Installs latest Chromium (92) package. +RUN apk add --no-cache \ + chromium \ + nss \ + freetype \ + harfbuzz \ + ca-certificates \ + ttf-freefont \ + nodejs \ + gcc \ + g++ \ + python3 \ + make \ + yarn + +# Tell Puppeteer to skip installing Chrome. We'll be using the installed package. +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \ + PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser + +# Puppeteer v10.0.0 works with Chromium 92. +RUN yarn add puppeteer@10.0.0 + +# Add user so we don't need --no-sandbox. +RUN addgroup -S pptruser && adduser -S -g pptruser pptruser \ + && mkdir -p /home/pptruser/Downloads /app \ + && chown -R pptruser:pptruser /home/pptruser \ + && chown -R pptruser:pptruser /app + +# Run everything after as non-privileged user. +WORKDIR /app + +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true +ENV CHROMIUM_PATH /usr/bin/chromium-browser +ENV LAUNCH_HEADLESS=true + +COPY package.json . +COPY yarn.lock . +COPY tsconfig.json . +COPY .prettierrc . +COPY .eslintrc . + +COPY /packages/content-fetch ./packages/content-fetch + +RUN yarn install --pure-lockfile + +EXPOSE 8080 + +CMD ["yarn", "workspace", "@omnivore/content-fetch", "start"] \ No newline at end of file