Hi,
I create a docker image on top of marketsquare/robotframework-browser:v6.0.0
docker image :
FROM marketsquare/robotframework-browser:v6.0.0
USER root
WORKDIR /usr/src/app
RUN mkdir -m 755 logs
USER pwuser
COPY tasks/ ./tasks/
COPY libraries/ ./libraries/
COPY resources/ ./resources/
COPY variables/ ./variables/
COPY install/requirements.txt .
...
CMD robot --nostatusrc --outputdir logs -b debug.log tasks/*.robot \
&& cat logs/debug.log
I am having issue with write permissions on logs folder. When the image starts, I get a PermissionDenied
error from robot claiming that it must not write the output.xml
.
I already tried playing with users root
and pwuser
which I found in the original GItHub repository. But maybe my sources were outdated…
How can I create a folder and execute robot inside the image?
Regards,
Markus
is that because you set permission 755… so I guess root has write permission to the logs but the pwuser has only read and execute permissions ?
There is some kind of authorization mix between root and pwuser. One is running with python3
and pip3
, the other on python
and pip
. Only 1 of them seems to have access to nodejs.
Anyway, it seems to be working like this, giving pwuser explicit ownership of the WORKDIR
:
FROM marketsquare/robotframework-browser:v6.0.0
USER root
WORKDIR /app
RUN mkdir logs \
&& chown -R pwuser:pwuser /app
USER pwuser
COPY tasks/ ./tasks/
COPY libraries/ ./libraries/
COPY resources/ ./resources/
COPY variables/ ./variables/
COPY install/requirements.txt .
RUN pip3 install -r requirements.txt
CMD robot --nostatusrc -d logs -b debug.log tasks/*.robot \
&& cat logs/debug.log
Like this, the tasks can be executed inside the container and I can use the container also as execution environment in my GitLab pipeline:
Validate syntax:
stage: validate
image: $CI_PROJECT_NAME:$CI_PIPELINE_ID
script:
- robot --dryrun tasks/*.robot
2 Likes