forked from ppodgorsek/docker-robot-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
101 lines (88 loc) · 3.72 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
FROM python:3.7-alpine3.10
MAINTAINER Paul Podgorsek <ppodgorsek@users.noreply.github.com>
LABEL description Robot Framework in Docker.
# Setup volume for output
VOLUME /opt/robotframework/reports
# Setup X Window Virtual Framebuffer
ENV SCREEN_COLOUR_DEPTH 24
ENV SCREEN_HEIGHT 1080
ENV SCREEN_WIDTH 1920
# Set number of threads for parallel execution
# By default, no parallelisation
ENV ROBOT_THREADS 1
# Dependency versions
ENV ALPINE_GLIBC 2.30-r0
ENV CHROMIUM_VERSION 79.0
ENV DATABASE_LIBRARY_VERSION 1.2
ENV FAKER_VERSION 4.3.0
ENV FIREFOX_VERSION 71.0
ENV FTP_LIBRARY_VERSION 1.8
ENV GECKO_DRIVER_VERSION v0.26.0
ENV IMAP_LIBRARY_VERSION 0.3.0
ENV PABOT_VERSION 0.96
ENV REQUESTS_VERSION 0.6.2
ENV ROBOT_FRAMEWORK_VERSION 3.1.2
ENV SELENIUM_LIBRARY_VERSION 4.1.0
ENV SSH_LIBRARY_VERSION 3.4.0
ENV XVFB_VERSION 1.20
# Prepare binaries to be executed
COPY bin/chromedriver.sh /opt/robotframework/bin/chromedriver
COPY bin/chromium-browser.sh /opt/robotframework/bin/chromium-browser
COPY bin/run-tests-in-virtual-screen.sh /opt/robotframework/bin/
# Install system dependencies
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk update \
&& apk --no-cache upgrade \
&& apk --no-cache --virtual .build-deps add \
gcc \
libffi-dev \
linux-headers \
make \
musl-dev \
openssl-dev \
which \
wget \
&& apk --no-cache add \
"chromium~$CHROMIUM_VERSION" \
"chromium-chromedriver~$CHROMIUM_VERSION" \
"firefox~$FIREFOX_VERSION" \
xauth \
"xvfb-run~$XVFB_VERSION" \
&& mv /usr/lib/chromium/chrome /usr/lib/chromium/chrome-original \
&& ln -sfv /opt/robotframework/bin/chromium-browser /usr/lib/chromium/chrome \
# FIXME: above is a workaround, as the path is ignored
# Install Robot Framework and Selenium Library
&& pip3 install \
--no-cache-dir \
robotframework==$ROBOT_FRAMEWORK_VERSION \
robotframework-databaselibrary==$DATABASE_LIBRARY_VERSION \
robotframework-faker==$FAKER_VERSION \
robotframework-ftplibrary==$FTP_LIBRARY_VERSION \
robotframework-imaplibrary==$IMAP_LIBRARY_VERSION \
robotframework-pabot==$PABOT_VERSION \
robotframework-requests==$REQUESTS_VERSION \
robotframework-seleniumlibrary==$SELENIUM_LIBRARY_VERSION \
robotframework-sshlibrary==$SSH_LIBRARY_VERSION \
PyYAML \
# Download the glibc package for Alpine Linux from its GitHub repository
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
&& wget -q "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$ALPINE_GLIBC/glibc-$ALPINE_GLIBC.apk" \
&& wget -q "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$ALPINE_GLIBC/glibc-bin-$ALPINE_GLIBC.apk" \
&& apk add glibc-$ALPINE_GLIBC.apk \
&& apk add glibc-bin-$ALPINE_GLIBC.apk \
&& rm glibc-$ALPINE_GLIBC.apk \
&& rm glibc-bin-$ALPINE_GLIBC.apk \
&& rm /etc/apk/keys/sgerrand.rsa.pub \
# Download Gecko drivers directly from the GitHub repository
&& wget -q "https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRIVER_VERSION/geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz" \
&& tar xzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
&& mkdir -p /opt/robotframework/drivers/ \
&& mv geckodriver /opt/robotframework/drivers/geckodriver \
&& rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
&& apk del --no-cache --update-cache .build-deps
# Update system path
ENV PATH=/opt/robotframework/bin:/opt/robotframework/drivers:$PATH
# Execute all robot tests
CMD ["run-tests-in-virtual-screen.sh"]