From 6864e08ae1b34c4534b1f1ece32640ac12c634a9 Mon Sep 17 00:00:00 2001 From: Jay MOULIN Date: Tue, 21 Nov 2017 13:36:53 +0100 Subject: [PATCH] fixes #2 - multiarch for chromium --- .gitignore | 3 +++ Dockerfile | 42 +++++++++++++++++++++++++++++++----------- Makefile | 23 +++++++++++++++++++++++ entrypoint.sh | 2 +- manifest.yml | 18 ++++++++++++++++++ 5 files changed, 76 insertions(+), 12 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 manifest.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c8450b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.build +*.yaml +qemu-*-static diff --git a/Dockerfile b/Dockerfile index 68f16ac..c2bfc94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,38 @@ -FROM bitnami/minideb +FROM debian:stable-slim as builder -MAINTAINER Jay MOULIN +ADD qemu-*-static /usr/bin/ + +FROM builder + +LABEL maintainer="Jay MOULIN " ENV CHROME_DEBUG_PORT=9222 +ARG ISARM=0 -# Install deps + add Chrome Stable + purge all the things -RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg --no-install-recommends && \ - curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \ - echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \ - apt-get update && apt-get install -y google-chrome-stable --no-install-recommends && \ - apt-get purge --auto-remove -y curl gnupg && \ - rm -rf /var/lib/apt/lists/* && \ - groupadd -r chrome && useradd -r -g chrome -G audio,video chrome && \ - mkdir -p /home/chrome/reports && chown -R chrome:chrome /home/chrome +RUN if [ ${ISARM:-0} = 1 ]; then echo "\ + deb http://ports.ubuntu.com/ trusty main restricted universe multiverse \ + deb http://ports.ubuntu.com/ trusty-updates main restricted universe multiverse \ + deb http://ports.ubuntu.com/ trusty-security main restricted universe multiverse \ + " >> /etc/apt/sources.list; else echo "\ + deb http://archive.ubuntu.com/ubuntu/ bionic main restricted \ + deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted \ + deb http://archive.ubuntu.com/ubuntu/ bionic universe \ + deb-src http://archive.ubuntu.com/ubuntu/ bionic universe \ + deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe \ + deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates universe \ + deb http://archive.ubuntu.com/ubuntu/ bionic multiverse \ + deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse \ + deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse \ + deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted \ + deb http://security.ubuntu.com/ubuntu/ bionic-security universe \ + deb-src http://security.ubuntu.com/ubuntu/ bionic-security universe \ + deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse \ + " >> /etc/apt/sources.list; fi && \ + apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg chromium-browser --no-install-recommends --allow-unauthenticated && \ + apt-get purge --auto-remove -y curl gnupg --allow-remove-essential && \ + rm -rf /var/lib/apt/lists/* && \ + groupadd -r chrome && useradd -r -g chrome -G audio,video chrome && \ + mkdir -p /home/chrome/reports && chown -R chrome:chrome /home/chrome COPY entrypoint.sh /usr/bin/entrypoint diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4cc8ab2 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +VERSION ?= 0.2.0 +FULLVERSION ?= ${VERSION} +archs = arm32v7 amd64 i386 +.PHONY: all build publish latest version +all: build publish +build: + cp /usr/bin/qemu-*-static . + $(foreach arch,$(archs), \ + cat Dockerfile | sed "s/FROM debian:stable-slim/FROM $(arch)\/debian:stable-slim/g" > .build; \ + if [ $(arch) = arm32v7 ]; then \ + docker build -t femtopixel/google-chrome-headless:${VERSION}-$(arch) -f .build --build-arg ISARM=1 .;\ + else docker build -t femtopixel/google-chrome-headless:${VERSION}-$(arch) -f .build --build-arg ISARM=0 .;\ + fi;\ + ) +publish: + docker push femtopixel/google-chrome-headless + cat manifest.yml | sed "s/\$$VERSION/${VERSION}/g" > manifest2.yaml + cat manifest2.yaml | sed "s/\$$FULLVERSION/${FULLVERSION}-debian/g" > manifest.yaml + manifest-tool push from-spec manifest.yaml +latest: build + cat manifest.yml | sed "s/\$$VERSION/${VERSION}/g" > manifest2.yaml + cat manifest2.yaml | sed "s/\$$FULLVERSION/latest/g" > manifest.yaml + manifest-tool push from-spec manifest.yaml diff --git a/entrypoint.sh b/entrypoint.sh index 4388f21..d093b2a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,7 @@ set -e # first arg is `http` or `--some-option` if [[ "http*" == "$1" ]] || [[ "-*" == "$1" ]] || [[ "about:blank" == "$1" ]] || [[ "$#" == 0 ]]; then - set -- google-chrome --headless --disable-gpu --remote-debugging-address=0.0.0.0 --remote-debugging-port=$CHROME_DEBUG_PORT "$@" + set -- chromium-browser --headless --disable-gpu --remote-debugging-address=0.0.0.0 --remote-debugging-port=$CHROME_DEBUG_PORT "$@" fi exec "$@" diff --git a/manifest.yml b/manifest.yml new file mode 100644 index 0000000..3e7a4cd --- /dev/null +++ b/manifest.yml @@ -0,0 +1,18 @@ +image: femtopixel/google-chrome-headless:$FULLVERSION +manifests: + - + image: femtopixel/google-chrome-headless:$VERSION-arm32v7 + platform: + architecture: arm + variant: v7 + os: linux + - + image: femtopixel/google-chrome-headless:$VERSION-i386 + platform: + architecture: 386 + os: linux + - + image: femtopixel/google-chrome-headless:$VERSION-amd64 + platform: + architecture: amd64 + os: linux