Use a different Dockerfile for content-fetch with App Engine and docker-compose

This commit is contained in:
Jackson Harper
2022-06-17 17:12:33 -07:00
parent ce86e7ccc5
commit 1d99bfaa10
2 changed files with 55 additions and 13 deletions

View File

@ -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"]
ENTRYPOINT ["yarn", "start"]

View File

@ -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"]