initial commit

This commit is contained in:
surtur 2020-06-10 23:26:06 +02:00
commit fa7ccb8561
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
3 changed files with 56 additions and 0 deletions

34
Dockerfile Normal file

@ -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"]

12
README.md Normal file

@ -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`)

10
hooks/build Normal file

@ -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 .