Skip to content

Commit

Permalink
#21 Integate variablefiles in docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
picard-remi committed Jan 21, 2024
1 parent e8c55d7 commit 88be073
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM python:3.11

ENV SUITE_FOLDER .
ENV VARIABLE_FILES ""
ENV PORT 5003

WORKDIR robot
Expand All @@ -10,4 +11,6 @@ RUN pip install robotframework-webservice

EXPOSE ${PORT}

ENTRYPOINT exec python -m RobotFrameworkService.main -p ${PORT} -t ${SUITE_FOLDER}
COPY docker-entrypoint.sh entrypoint.sh
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/robot/entrypoint.sh"]
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <host directory of test cases>:/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 <host directory of test cases>:/robot/tests --env SUITE_FOLDER=tests rf-webservice:latest
docker run --rm --publish 5003:5003 \
--volume <host directory of test cases>:/robot/tests \
--volume <host directory of variable files>:/robot/variables \
--env SUITE_FOLDER=tests \
--env "VARIABLE_FILES=variables/variables.py variables/variables2.py" \
ghcr.io/marketsquare/robotframework-webservice:master
```

## Podman
Expand Down
9 changes: 9 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 88be073

Please sign in to comment.