Skip to content

Commit

Permalink
add pino and fix docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianNEMO committed Aug 28, 2023
1 parent 8ac3535 commit 538b5d1
Show file tree
Hide file tree
Showing 8 changed files with 511 additions and 104 deletions.
10 changes: 10 additions & 0 deletions .puppeteerrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

const {join} = require('path');

/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ COPY buf.gen.yaml .
COPY src src
COPY proto proto

ENV PUPPETEER_SKIP_DOWNLOAD=true

RUN VERSION="1.4.0" && \
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m)" \
-o "/usr/local/bin/buf" && \
chmod +x "/usr/local/bin/buf"

RUN VERSION="3.15.8" && \
curl -LO "https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-x86_64.zip" && \
unzip "protoc-${VERSION}-linux-x86_64.zip" -d /

RUN npm install && npm run build

FROM node:18-slim
Expand All @@ -36,6 +34,8 @@ RUN apt-get update \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable

RUN GRPC_HEALTH_PROBE_VERSION=v0.4.11 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe
Expand All @@ -46,6 +46,7 @@ COPY --from=builder /usr/src/rendertron/package.json .
COPY --from=builder /usr/src/rendertron/node_modules node_modules
COPY --from=builder /usr/src/rendertron/build build
COPY --from=builder /usr/src/rendertron/generated generated
COPY .puppeteerrc.cjs .

# Install puppeteer so it's available in the container.
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
Expand All @@ -56,4 +57,4 @@ RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
# Run everything after as non-privileged user.
USER pptruser

ENTRYPOINT ["npm", "run", "start"]
ENTRYPOINT ["node", "build/src/index.js"]
Loading

0 comments on commit 538b5d1

Please sign in to comment.