This commit is contained in:
jay 2019-03-09 22:06:16 +08:00
commit 379f028e6e
4 changed files with 48 additions and 0 deletions

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM alpine:latest
# Switch to edge (for latest firefox)
RUN sed -i -e 's/v[[:digit:]]\.[[:digit:]]/edge/g' /etc/apk/repositories
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN apk update && apk upgrade
RUN apk add firefox-esr jq xvfb curl openjdk8-jre
RUN rm -rf /var/cache/apk/*
COPY geckodriver.sh geckodriver.sh
RUN sh geckodriver.sh

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# geckodriver-alpine
Firefox and Geckodriver on Alpine edge

34
geckodriver.sh Normal file
View File

@ -0,0 +1,34 @@
#!/bin/sh
json=$(curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest)
os=$(uname -s)
arch=$(uname -m)
if [ $os = "Linux" ] ; then
case "$arch" in
i386 | i486 | i786 | x86)
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("linux32"))')
;;
x86_64 | x86-64 | x64 | amd64)
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("linux64"))')
;;
xscale | arm | armv61 | armv71 | armv81 | aarch64)
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("arm7hf"))')
;;
*)
echo Architecture not supported: $arch
exit 1
;;
esac
elif [ $os = "Darwin" ] ; then
url=$(echo "$json" | jq -r '.assets[].browser_download_url | select(contains("macos"))')
fi
if [ -z $url ] ; then
echo OS not supported: $os
exit 1
fi
echo $url
curl -s -L "$url" | tar -xz
chmod +x geckodriver
mv geckodriver /usr/bin

Binary file not shown.