feat: refactor Dockerfile

This commit is contained in:
2023-01-09 15:19:55 +01:00
parent d0fc1aca74
commit 31f683f766
3 changed files with 49 additions and 26 deletions
+16 -26
View File
@@ -1,29 +1,19 @@
FROM python:3
FROM python:3.9-slim-bullseye
LABEL maintainer="Joakim Olsson <joakim@unbound.se>"
LABEL description="Base image for running Robot Framework test suites in Docker. \
\
The image cotains the following Robot Framework libraries:\
- Appium library - Keywords for Android & IOS device UI tests \
- Database library - Keywords for SQL queries & statements \
- HTTP library - Keywords for HTTP & Rest \
- RabbitMQ library - Keywords for Rabbit MQ \
- Selenium2 library - Keywords for cross browser tests\
\
Drivers:\
- psycopg2 - Python driver for Postgres \
- PyMySQL - Python driver for MySQL"
ARG TARGETOS
ARG TARGETARCH
ARG GECKODRIVER_VERSION=0.32.0
RUN apt-get update && \
apt-get -y install jq firefox-esr && \
rm -r /var/lib/apt/lists/* && \
pip install \
urllib3 \
psycopg2-binary \
PyMySQL \
robotframework==6.0.1 \
robotframework-appiumlibrary \
robotframework-databaselibrary \
robotframework-httplibrary \
-e "git+https://github.com/JakUi/robotframework-rabbitmq-fork#egg=robotframework-rabbitmq-ao" \
robotframework-selenium2library
apt-get -y install jq firefox-esr curl git && \
rm -r /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt && \
rm requirements.txt
COPY geckodriver.sh .
RUN ./geckodriver.sh $GECKODRIVER_VERSION $TARGETOS $TARGETARCH && \
rm geckodriver.sh
# echo "192.168.65.2 app-acctest auth0 api-acctest" >> /etc/hosts
Executable
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
set -o errexit -o pipefail -o noclobber -o nounset
VERSION=${1:-"0.32.0"}
OS=${2:-linux}
ARCH=${3:-}
OS_ARCH=""
if [ "${ARCH}" == "amd64" ]; then
OS_ARCH="${OS}64"
elif [ "${ARCH}" == "arm64" ]; then
OS_ARCH="${OS}-aarch64"
fi
GH_URL="https://github.com/mozilla/geckodriver/releases/download/"
TMP_FILE="geckodriver.tar.gz"
curl -L -s \
-o ${TMP_FILE} \
"${GH_URL}v${VERSION}/geckodriver-v${VERSION}-${OS_ARCH}.tar.gz"
tar -xzf ${TMP_FILE}
mv geckodriver /usr/bin
rm ${TMP_FILE}
+9
View File
@@ -0,0 +1,9 @@
robotframework==6.0.1
robotframework-seleniumlibrary==6.0.0
urllib3==1.26.13
psycopg2-binary==2.9.5
PyMySQL==1.0.2
robotframework-appiumlibrary==2.0.0
robotframework-databaselibrary==1.2.4
robotframework-httplibrary==0.4.2
git+https://github.com/JakUi/robotframework-rabbitmq-fork#egg=robotframework-rabbitmq-ao