Skip to content

Commit

Permalink
fixes #2 - multiarch for chromium
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymoulin committed Nov 30, 2017
1 parent 13a6bb7 commit 6864e08
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.build
*.yaml
qemu-*-static
42 changes: 31 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
FROM bitnami/minideb
FROM debian:stable-slim as builder

MAINTAINER Jay MOULIN <[email protected]> <http://twitter.com/moulinjay>
ADD qemu-*-static /usr/bin/

FROM builder

LABEL maintainer="Jay MOULIN <[email protected]> <http://twitter.com/moulinjay>"

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

Expand Down
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"

18 changes: 18 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6864e08

Please sign in to comment.