commit fa7ccb856109dd5d704017e322a78d34aca8ca67 Author: surtur Date: Wed Jun 10 23:26:06 2020 +0200 initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c71de99 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM python:3.9-rc-alpine + +RUN apk -U upgrade +RUN apk add --no-cache \ + udev \ + chromium \ + chromium-chromedriver \ + xvfb \ + bash + +RUN pip install --no-cache-dir \ + robotframework \ + robotframework-selenium2library \ + selenium + +# Chrome requires docker to have cap_add: SYS_ADMIN if sandbox is on. +# Disabling sandbox and gpu as default. +RUN sed -i "s/self._arguments\ =\ \[\]/self._arguments\ =\ \['--no-sandbox',\ '--disable-gpu'\]/" /usr/local/lib/python3.9/site-packages/selenium/webdriver/chrome/options.py + +ENV ROBOT_UID 1000 +ENV ROBOT_NAME rf +# this user (uid==1000) can be used to run tests instead of the root user +# changing the uid (and name) is straightforward +# 'su rf' after startup +RUN adduser -u ${ROBOT_UID} -D -H ${ROBOT_NAME} + +RUN mkdir -pv /testing + +ENV SCREEN_WIDTH 1920 +ENV SCREEN_HEIGHT 1080 +ENV SCREEN_DEPTH 16 + +WORKDIR /testing +ENTRYPOINT ["/bin/bash"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..d86bffe --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# docker-alpine-rf + +This repository provides the Dockerfile to create a container image for [robotframework](https://robotframework.org) website testing. + +## What you get +* updated python[`:3.9-rc-alpine`](https://hub.docker.com/_/python) image +* robot framework +* selenium library +* chromium +* chrome driver +* bash as kind of a convenience (the base is a python image) +* `rf` user (uid==1000) that can be used to run tests (instead of `root`) diff --git a/hooks/build b/hooks/build new file mode 100644 index 0000000..4c69a76 --- /dev/null +++ b/hooks/build @@ -0,0 +1,10 @@ +#!/bin/bash + +# as per https://github.com/rossf7/label-schema-automated-build + +# $IMAGE_NAME var is injected into the build so the tag is correct. + +echo "Build hook running" +docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ + --build-arg VCS_REF=`git rev-parse --short HEAD` \ + -t $IMAGE_NAME .