tests/tools/Docker/Dockerfile
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sun, 15 Jan 2023 21:40:58 +0100
branchwxPython4
changeset 3716 3dafdb6ad023
parent 3715 961903c0b76d
child 3724 ad3a05cf2066
permissions -rw-r--r--
IDE: fix exception when showing project's context menu in case of empty clipboard (wxpython4).
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
#
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
# Dockerfile for Beremiz
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
# This container is used to run tests for Beremiz
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
#
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
FROM ubuntu:focal  
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
                                        
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
ENV TERM xterm-256color
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
    
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     9
ENV LANG en_US.UTF-8
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
ENV LANGUAGE en_US:en
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
ENV LC_ALL en_US.UTF-8
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
ARG UNAME=testing
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    14
ENV UNAME ${UNAME}
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
ARG UID=1000
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    16
ARG GID=1000
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    17
RUN groupadd -g $GID $UNAME
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    18
RUN useradd -m -u $UID -g $GID -s /bin/bash $UNAME
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    19
3715
961903c0b76d Tests: Fix dockerfile not finding locales.
etisserant <edouard.tisserant@gmail.com>
parents: 3710
diff changeset
    20
RUN set -xe \
961903c0b76d Tests: Fix dockerfile not finding locales.
etisserant <edouard.tisserant@gmail.com>
parents: 3710
diff changeset
    21
    && apt-get update \
961903c0b76d Tests: Fix dockerfile not finding locales.
etisserant <edouard.tisserant@gmail.com>
parents: 3710
diff changeset
    22
    && apt-get install locales \
961903c0b76d Tests: Fix dockerfile not finding locales.
etisserant <edouard.tisserant@gmail.com>
parents: 3710
diff changeset
    23
    && locale-gen en_US.UTF-8 \
961903c0b76d Tests: Fix dockerfile not finding locales.
etisserant <edouard.tisserant@gmail.com>
parents: 3710
diff changeset
    24
    && update-locale LANG=en_US.UTF-8
3710
51c2d434e10e tests: IDE: own text matching logic for OCR reliability, enhanced ihtml report
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3697
diff changeset
    25
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    26
RUN set -xe \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    27
    && TZ="America/Paris" \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    28
       DEBIAN_FRONTEND="noninteractive" \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    29
       apt-get install -y --no-install-recommends \
3679
b6bca75bf3fa Tests: force bigger fonts and flat theme in GTK to make OCR more reliable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3549
diff changeset
    30
               `# to run sikuli` \
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    31
               wget \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    32
               libopencv4.2-java \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    33
               openjdk-11-jre \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    34
               \
3679
b6bca75bf3fa Tests: force bigger fonts and flat theme in GTK to make OCR more reliable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3549
diff changeset
    35
               `# to run X based tests` \
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    36
               fluxbox \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    37
               wmctrl xdotool xvfb \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    38
               x11vnc xterm xnest \
3679
b6bca75bf3fa Tests: force bigger fonts and flat theme in GTK to make OCR more reliable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3549
diff changeset
    39
               materia-gtk-theme \
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    40
               \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    41
               `# to build tested apps` \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    42
               build-essential automake flex bison mercurial \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    43
               libgtk-3-dev libgl1-mesa-dev libglu1-mesa-dev \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    44
               libpython2.7-dev libssl-dev \
3549
0af7b6a96c53 CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3542
diff changeset
    45
               python2 virtualenv cmake
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    46
3679
b6bca75bf3fa Tests: force bigger fonts and flat theme in GTK to make OCR more reliable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3549
diff changeset
    47
b6bca75bf3fa Tests: force bigger fonts and flat theme in GTK to make OCR more reliable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3549
diff changeset
    48
# force bigger font and flat theme for GTK in order to make OCR more reliable
b6bca75bf3fa Tests: force bigger fonts and flat theme in GTK to make OCR more reliable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3549
diff changeset
    49
RUN mkdir -p /etc/gtk-3.0
b6bca75bf3fa Tests: force bigger fonts and flat theme in GTK to make OCR more reliable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3549
diff changeset
    50
RUN env echo -e '[Settings]\ngtk-font-name=FreeSans,12\ngtk-theme-name=Materia\n' > /etc/gtk-3.0/settings.ini
b6bca75bf3fa Tests: force bigger fonts and flat theme in GTK to make OCR more reliable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3549
diff changeset
    51
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    52
# link obtained from https://raiman.github.io/SikuliX1/downloads.html
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    53
RUN set -xe && \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    54
    wget -qP /usr/local/bin \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    55
        https://launchpad.net/sikuli/sikulix/2.0.5/+download/sikulixide-2.0.5.jar && \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    56
    echo 0795f1e0866ee5a7a84e4c89793ea78c /usr/local/bin/sikulixide-2.0.5.jar | md5sum -c && \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    57
    ( echo '#!/bin/sh' && \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    58
      echo "exec java -jar /usr/local/bin/sikulixide-*.jar \"\$@\"" \
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    59
    ) | install /dev/stdin /usr/local/bin/sikulix
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    60
3458
2c712b8c736f Tests: use script rather than alias so that bash doesn't need to be interactive shell with a TTY
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3438
diff changeset
    61
3697
12b6add87876 tests/tools: move comment and remove dead code in Dockerfile
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3696
diff changeset
    62
# easy to remember 'do_tests' alias to invoke main makefile
3542
c1d627434cd1 tests: docker: add dependencies for CLI testing
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3459
diff changeset
    63
RUN env echo -e '#!/bin/bash\nmake -f /home/testing/src/beremiz/tests/Makefile $*' > /usr/local/bin/do_tests
3458
2c712b8c736f Tests: use script rather than alias so that bash doesn't need to be interactive shell with a TTY
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3438
diff changeset
    64
RUN chmod +x /usr/local/bin/do_tests
2c712b8c736f Tests: use script rather than alias so that bash doesn't need to be interactive shell with a TTY
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3438
diff changeset
    65
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    66
USER $UNAME
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    67
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    68
RUN mkdir /home/$UNAME/build /home/$UNAME/src /home/$UNAME/test
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    69
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    70
RUN virtualenv --python=$(which python2) ~/beremizenv
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    71
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    72
RUN ~/beremizenv/bin/pip install \
3438
24fbd4d1fe80 Tests: Re-introduced pytest based tests. Fixed them a bit, commented-out otherwise. Application tests only runs with logging test, and PLCOpenEditor tests seem broken.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3431
diff changeset
    73
        pytest pytest-timeout ddt \
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    74
        lxml future matplotlib zeroconf2 enum34 pyro sslpsk posix_spawn \
3549
0af7b6a96c53 CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3542
diff changeset
    75
        twisted nevow autobahn click opcua \
3425
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    76
        wxPython==4.1.1
ee3b84d09ccf Add Docker image definition as reference platform to run IDE tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    77
3696
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    78
RUN set -xe && \
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    79
    cd  /home/$UNAME && mkdir tessdata && \
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    80
    wget -q https://github.com/tesseract-ocr/tessdata/archive/refs/tags/4.1.0.tar.gz \
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    81
         -O tessdata.tar.gz && \
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    82
    echo 89e25c7c40a59be7195422a01f57fcb2 tessdata.tar.gz | md5sum -c && \
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    83
    tar --strip-components=1 -C tessdata -x -v -z -f tessdata.tar.gz && \
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    84
    rm tessdata.tar.gz
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    85
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    86
ENV TESSDATAPATH /home/$UNAME/tessdata
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    87
ea30051326e9 tests: add tesseract training data "tessdata", still trying to enhance OCR reliability in UI tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3693
diff changeset
    88
# Points to python binary that test will use
3431
5bcef31e276d Tests: Added BEREMIZPYTHONPATH to point to Python interpreter to use for tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3425
diff changeset
    89
ENV BEREMIZPYTHONPATH /home/$UNAME/beremizenv/bin/python
5bcef31e276d Tests: Added BEREMIZPYTHONPATH to point to Python interpreter to use for tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3425
diff changeset
    90