Skip to content

Commit

Permalink
support arm64 / amd64 arch (garris#1300)
Browse files Browse the repository at this point in the history
  • Loading branch information
Torsten Krah authored and Torsten Krah committed Mar 15, 2023
1 parent 9f7dfd5 commit 4b1fbe9
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 30 deletions.
45 changes: 15 additions & 30 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
FROM node:16.14.0
# use bullseye node base, as debian does provide a chromium for arm64 and amd64 flavour
FROM node:16-bullseye

ARG BACKSTOPJS_VERSION
ARG DEBIAN_FRONTEND=noninteractive

ENV \
BACKSTOPJS_VERSION=$BACKSTOPJS_VERSION
ENV BACKSTOPJS_VERSION=$BACKSTOPJS_VERSION

# Base packages
RUN apt-get update && \
apt-get install -y git sudo software-properties-common
# install chromium and its deps
RUN apt-get -qq update >/dev/null && apt-get install -qq fonts-liberation chromium >/dev/null

RUN sudo npm install -g --unsafe-perm=true --allow-root backstopjs@${BACKSTOPJS_VERSION}

RUN wget https://dl-ssl.google.com/linux/linux_signing_key.pub && sudo apt-key add linux_signing_key.pub
RUN sudo add-apt-repository "deb http://dl.google.com/linux/chrome/deb/ stable main"

# RUN apt-get -y update && apt-get -y install google-chrome-stable

# RUN apt-get install -y firefox-esr

# gconf-service libxext6.... added for https://github.com/garris/BackstopJS/issues/1225

RUN apt-get -qqy update \
&& apt-get -qqy --no-install-recommends install \
libfontconfig \
libfreetype6 \
xfonts-cyrillic \
xfonts-scalable \
fonts-liberation \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
libgbm-dev \
gconf-service libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxss1 libxtst6 libappindicator1 libnss3 libasound2 libatk1.0-0 libc6 ca-certificates fonts-liberation lsb-release xdg-utils wget \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -qyy clean
USER root
# skip download, we already have it installed
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
RUN npm install -g --unsafe-perm=true --allow-root backstopjs@${BACKSTOPJS_VERSION}
RUN rm -rf /var/lib/apt/lists/* \ && apt-get -qq clean >/dev/null

USER node

# set executable path
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
WORKDIR /src

ENTRYPOINT ["backstop"]

35 changes: 35 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,38 @@ docker run --rm -v $(pwd):/src -it --entrypoint=bash backstopjs/backstopjs

## Jenkins Guide
You could get a Jenkins Guide here: [Jenkins Guide](../examples/Jenkins)

## MultiArch Build

Your docker setup should have buildx support to be able to build that.

```
docker buildx create --name mybuilder --use --bootstrap
```

Build + Push:

```
export BACKSTOPJS_VERSION=6.1.4
docker buildx build --push --build-arg BACKSTOPJS_VERSION --platform linux/amd64,linux/arm64 --tag backstopjs/backstopjs:$BACKSTOPJS_VERSION
```

### local load to your registry

build + load it to your registry (load does not support more than 1 platform, push does https://github.com/docker/buildx/issues/59):

AMD64:

```
export BACKSTOPJS_VERSION=6.1.4
docker buildx build --build-arg BACKSTOPJS_VERSION --platform linux/amd64 --load --tag backstopjs/backstopjs:$BACKSTOPJS_VERSION
```

ARM64:

```
export BACKSTOPJS_VERSION=6.1.4
docker buildx build --build-arg BACKSTOPJS_VERSION --platform linux/arm64 --load --tag backstopjs/backstopjs:$BACKSTOPJS_VERSION
```

0 comments on commit 4b1fbe9

Please sign in to comment.