Use with testcafe docker image
See original GitHub issueI am curious if there is any way to include this library when running testcafe from within docker?
I have attempted to create a new docker image based off testcafe/testcafe
, but ran into permissions-related issues when attempting to install testcafe-react-selectors via npm from within my new Dockerfile.
Another approach I made that I really am not entirely keen on involved essentially copying the Dockerfile from the testcafe github and adding multiple steps to basically ADD
the testcafe release tar.gz, install gulp, build testcafe, copy the required directories to /opt/testcafe within the image and then finally install testcafe-react-selectors seperately. Not fun.
It’s entirely possible I’m missing something amazingly simple, but I would appreciate any advice you could give about being able to completely contain both testcafe and this library within a single-entrypoint docker image.
Thanks!
EDIT - Just to give you an example of the truly horrible hoops I jumped through…
FROM alpine:edge
RUN apk --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ add \
nodejs nodejs-npm chromium firefox xwininfo xvfb dbus eudev ttf-freefont fluxbox
ADD https://github.com/DevExpress/testcafe/archive/v0.16.2.tar.gz /opt
RUN npm install -g gulp && \
mkdir -p /opt/testcafe && \
cd /opt/testcafe-0.16.2 && \
npm install && \
gulp build && \
cp -r docker /opt/testcafe && \
cp -r lib /opt/testcafe && \
cp -r bin /opt/testcafe && \
cp -r package.json /opt/testcafe && \
cd /opt/testcafe && \
npm install --production && \
npm install testcafe-react-selectors && \
npm cache clean && \
rm -fr /tmp/* && \
rm -fr /opt/testcafe-0.16.2 && \
chmod +x /opt/testcafe/docker/testcafe-docker.sh && \
adduser -D user
USER user
EXPOSE 1337 1338
ENTRYPOINT ["/opt/testcafe/docker/testcafe-docker.sh"]
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
I had to slightly edit @sobolevn solution to add the
/usr/lib/node_modules
toNODE_PATH
. If not, I was running in the following error :My resulting Dockerfile is the following :
@lgriotti The
cd
command should change the current directory to the directory containing yourpackage.json
.