From 997ccd697140a5da9229509e8c8d8de039112417 Mon Sep 17 00:00:00 2001 From: Oh My Felix Date: Fri, 5 Jun 2026 21:43:29 +0000 Subject: [PATCH 1/2] Docs: align README badges, drop Gitter, note upstream deprecation Align the badge block with the rest of the Dockette org (copybara / apidoc style): four img.shields.io badges (Actions, Docker Hub pulls, Sponsor, Support/Discussions) with consistent alt text. Drop the now-dead Gitter badge and the redundant Docker Stars badge. Add a short upstream-status callout so users know that GoogleChrome/rendertron is archived and marked deprecated upstream, and that the image is kept for existing users and the demo screenshot. Add the standard Maintenance section to match the rest of the org. Co-authored-by: Felix --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c438730..df671b4 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,18 @@ Ready-to-use image for SSR rendering based on headless Chrome, [a.k.a Rendertron by Google](https://github.com/GoogleChrome/rendertron). -> All credits belong to authors of GoogleChrome/rendertron. +> All credits belong to the authors of [GoogleChrome/rendertron](https://github.com/GoogleChrome/rendertron). ------ - -[![Docker Stars](https://img.shields.io/docker/stars/dockette/rendertron.svg?style=flat)](https://hub.docker.com/r/dockette/rendertron/) -[![Docker Pulls](https://img.shields.io/docker/pulls/dockette/rendertron.svg?style=flat)](https://hub.docker.com/r/dockette/rendertron/) +> **Upstream status:** the [GoogleChrome/rendertron](https://github.com/GoogleChrome/rendertron) project was archived and the upstream README marks it as deprecated. The image here is kept for existing users and the demo screenshot; new projects should evaluate the alternative rendering strategies linked from the upstream README before adopting Rendertron. -## Discussion / Help +----- -[![Join the chat](https://img.shields.io/gitter/room/dockette/dockette.svg?style=flat-square)](https://gitter.im/dockette/dockette?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +

+ GitHub Actions + Docker Hub pulls + GitHub Sponsors + Support/Discussions +

## Usage From 672be21425abcd8d466732ffb39b1361dd97bf60 Mon Sep 17 00:00:00 2001 From: Milan Sulc Date: Mon, 8 Jun 2026 13:41:12 +0000 Subject: [PATCH 2/2] Fix Rendertron CI builds --- .github/workflows/docker.yml | 2 - .github/workflows/main.yml | 6 +-- rendertron/Dockerfile | 18 ++++----- .../middleware/src/test/middleware-test.ts | 4 +- rendertron/src/datastore-cache.ts | 5 ++- rendertron/src/filesystem-cache.ts | 4 +- rendertron/src/memory-cache.ts | 5 ++- rendertron/src/rendertron.ts | 9 ++++- tracer/Dockerfile | 37 +++---------------- 9 files changed, 35 insertions(+), 55 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e72986c..4c0c712 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -26,8 +26,6 @@ jobs: name: Docker (dockette/rendertron:${{ matrix.tag }}) - continue-on-error: "${{ matrix.tag == 'tracer' }}" - steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 932ca81..e130851 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 15 + node-version: 20 - run: npm ci - run: npm run lint - run: npm run build @@ -36,7 +36,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 15 + node-version: 20 - run: npm ci - run: npm run test - - run: npm run build \ No newline at end of file + - run: npm run build diff --git a/rendertron/Dockerfile b/rendertron/Dockerfile index f32048a..947a46f 100644 --- a/rendertron/Dockerfile +++ b/rendertron/Dockerfile @@ -1,17 +1,17 @@ -FROM node:15-slim +FROM node:20-bookworm-slim -RUN apt update && apt dist-upgrade -y && \ - apt install -y wget gnupg2 && \ - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list && \ - apt-get update && apt-get -y install google-chrome-stable libxss1 +ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \ + PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium + +RUN apt-get update && apt-get dist-upgrade -y && \ + apt-get install -y --no-install-recommends chromium ca-certificates && \ + rm -Rf /var/lib/apt/lists/* ADD ./ /srv -RUN npm --prefix /srv install && \ +RUN npm --prefix /srv ci && \ npm --prefix /srv run build && \ - rm -Rf /tmp/* && \ - rm -Rf /var/lib/apt/lists/* + rm -Rf /tmp/* WORKDIR /srv diff --git a/rendertron/middleware/src/test/middleware-test.ts b/rendertron/middleware/src/test/middleware-test.ts index f1591ce..91ae27a 100755 --- a/rendertron/middleware/src/test/middleware-test.ts +++ b/rendertron/middleware/src/test/middleware-test.ts @@ -26,8 +26,8 @@ import * as rendertron from '../middleware'; */ async function listen(app: express.Application): Promise { return new Promise((resolve: (url: string) => void) => { - const server = app.listen(/* random */ 0, 'localhost', () => { - resolve(`http://localhost:${(server.address() as net.AddressInfo).port}`); + const server = app.listen(/* random */ 0, '127.0.0.1', () => { + resolve(`http://127.0.0.1:${(server.address() as net.AddressInfo).port}`); }); }); } diff --git a/rendertron/src/datastore-cache.ts b/rendertron/src/datastore-cache.ts index 31a22c0..b92e462 100755 --- a/rendertron/src/datastore-cache.ts +++ b/rendertron/src/datastore-cache.ts @@ -20,6 +20,7 @@ 'use strict'; import Koa from 'koa'; +import { OutgoingHttpHeaders } from 'http'; import { Config, ConfigManager } from './config'; import { Datastore } from '@google-cloud/datastore'; @@ -57,8 +58,8 @@ export class DatastoreCache { async cacheContent( // eslint-disable-next-line @typescript-eslint/ban-types key: object, - headers: Record, - payload: Buffer + headers: OutgoingHttpHeaders, + payload: Koa.Context['body'] ) { const now = new Date(); // query datastore to see if we are over the max number of allowed entries, and max entries isn't disabled with a value of -1 and remove over quota, removes oldest first diff --git a/rendertron/src/filesystem-cache.ts b/rendertron/src/filesystem-cache.ts index 74900bc..d560ccf 100755 --- a/rendertron/src/filesystem-cache.ts +++ b/rendertron/src/filesystem-cache.ts @@ -242,7 +242,7 @@ export class FilesystemCache { ctx.set(response.header); ctx.set('x-rendertron-cached', content.saved.toUTCString()); ctx.status = response.status; - let payload: string | { type?: string } = content.payload; + let payload: string | { type?: string; data?: number[] } = content.payload; try { payload = JSON.parse(content.payload); } catch (e) { @@ -254,7 +254,7 @@ export class FilesystemCache { typeof payload === 'object' && payload.type === 'Buffer' ) { - ctx.body = Buffer.from(payload); + ctx.body = Buffer.from(payload.data || []); } else { ctx.body = payload; } diff --git a/rendertron/src/memory-cache.ts b/rendertron/src/memory-cache.ts index 7968c64..1b7f83f 100755 --- a/rendertron/src/memory-cache.ts +++ b/rendertron/src/memory-cache.ts @@ -20,6 +20,7 @@ 'use strict'; import Koa from 'koa'; +import { OutgoingHttpHeaders } from 'http'; import { Config, ConfigManager } from './config'; type CacheEntry = { @@ -40,8 +41,8 @@ export class MemoryCache { cacheContent( key: string, - headers: { [key: string]: string }, - payload: Buffer + headers: OutgoingHttpHeaders, + payload: Koa.Context['body'] ) { // if the cache gets too big, we evict the least recently used entry (i.e. the first value in the map) if ( diff --git a/rendertron/src/rendertron.ts b/rendertron/src/rendertron.ts index 842793e..9afb0f1 100755 --- a/rendertron/src/rendertron.ts +++ b/rendertron/src/rendertron.ts @@ -22,6 +22,10 @@ export class Rendertron { private port = process.env.PORT || null; private host = process.env.HOST || null; + private getQueryString(value: string | string[] | undefined) { + return Array.isArray(value) ? value[0] : value; + } + async createRenderer(config: Config) { const browser = await puppeteer.launch({ args: config.puppeteerArgs }); @@ -153,7 +157,7 @@ export class Rendertron { const serialized = await this.renderer.serialize( url, mobileVersion, - ctx.query.timezoneId + this.getQueryString(ctx.query.timezoneId) ); for (const key in this.config.headers) { @@ -192,7 +196,8 @@ export class Rendertron { url, mobileVersion, dimensions, - ctx.query.timezoneId + undefined, + this.getQueryString(ctx.query.timezoneId) ); for (const key in this.config.headers) { diff --git a/tracer/Dockerfile b/tracer/Dockerfile index 1c409ca..2c0b599 100644 --- a/tracer/Dockerfile +++ b/tracer/Dockerfile @@ -1,18 +1,12 @@ -FROM dockette/alpine:3.9 +FROM php:7.4-cli-alpine -MAINTAINER Milan Sulc +LABEL maintainer="Milan Sulc " -ADD https://dl.bintray.com/php-alpine/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub -ADD .docker/php.ini /etc/php7/conf.d/999-tracer.ini +ADD .docker/php.ini /usr/local/etc/php/conf.d/999-tracer.ini ENV TZ=Europe/Prague -RUN echo '@community http://nl.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \ - echo "@php https://dl.bintray.com/php-alpine/v3.9/php-7.3" >> /etc/apk/repositories && \ - # DEPENDENCIES ############################################################# - apk update && \ - apk upgrade && \ - apk --no-cache add \ +RUN apk --no-cache add \ bash \ git \ ca-certificates \ @@ -20,33 +14,14 @@ RUN echo '@community http://nl.alpinelinux.org/alpine/edge/community' >> /etc/ap openssh \ tzdata \ tini && \ - # PHP ###################################################################### - apk --no-cache add \ - php7@php \ - php7-ctype@php \ - php7-curl@php \ - php7-iconv@php \ - php7-intl@php \ - php7-json@php \ - php7-mbstring@php \ - php7-openssl@php \ - php7-session@php \ - php7-phar@php \ - php7-xml@php \ - php7-zip@php \ - php7-zlib@php && \ - ln -s /usr/bin/php7 /usr/bin/php && \ - # COMPOSER ################################################################# curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && \ - composer global require "hirak/prestissimo:^0.3" && \ - # CLEAN UP ################################################################# rm -rf /var/cache/apk/* WORKDIR /srv ADD ./ /srv RUN mkdir -p /srv/var && \ - composer install --no-suggest --prefer-dist + composer install --no-dev --no-interaction --prefer-dist ENTRYPOINT ["/sbin/tini", "--"] -CMD ["/usr/bin/php", "/srv/bin/tracer.php"] +CMD ["/usr/local/bin/php", "/srv/bin/tracer.php"]