diff --git a/Dockerfile b/Dockerfile index 0a18201..5714033 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM python:3.11 ENV SUITE_FOLDER . +ENV VARIABLE_FILES "" ENV PORT 5003 WORKDIR robot @@ -10,4 +11,6 @@ RUN pip install robotframework-webservice EXPOSE ${PORT} -ENTRYPOINT exec python -m RobotFrameworkService.main -p ${PORT} -t ${SUITE_FOLDER} \ No newline at end of file +COPY docker-entrypoint.sh entrypoint.sh +RUN chmod +x entrypoint.sh +ENTRYPOINT ["/robot/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index b767e5b..9e58a89 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,23 @@ A web service managing Robot Framework tasks/tests. This web service shall start Robot Framework tasks/tests and return and cache the according reports. # Installation and Execution -*Default docker image does not support variable files, yet* ## Docker +You can run the image and map your test cases into the webservice with a volume : ``` -docker pull ghcr.io/marketsquare/robotframework-webservice:master +docker run --rm --publish 5003:5003 \ + --volume :/robot/tests \ + --env SUITE_FOLDER=tests \ + ghcr.io/marketsquare/robotframework-webservice:master ``` -After that you can run the image and map your test cases in to the webservice with a volumen: +You can also run the image and map your test cases and your variable files (separated by spaces) into the webservice with volumes : ``` -docker run -v :/robot/tests --env SUITE_FOLDER=tests rf-webservice:latest +docker run --rm --publish 5003:5003 \ + --volume :/robot/tests \ + --volume :/robot/variables \ + --env SUITE_FOLDER=tests \ + --env "VARIABLE_FILES=variables/variables.py variables/variables2.py" \ + ghcr.io/marketsquare/robotframework-webservice:master ``` ## Podman diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..645c469 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -n "${VARIABLE_FILES}" ]; then + variablefiles="--variablefiles ${VARIABLE_FILES}" +else + variablefiles="" +fi + +exec python -m RobotFrameworkService.main --port "${PORT}" --taskfolder "${SUITE_FOLDER}" ${variablefiles} \ No newline at end of file