我有一个阶段,在那里我为我们的应用程序进行测试
test-dev:
stage: test
image: selenium/standalone-chrome
image: node:14.15.0-stretch
script:
- npm i
- npm run prod
- /opt/bin/start-selenium-standalone.sh
- npx mocha tests/js/screenshots-* --timeout 50000
- npx playwright test tests/js/pw_*
- php artisan test
artifacts:
when: always
name: $CI_COMMIT_SHA
untracked: true
paths:
- tests/js/screenshots/
- tests/js/screens/
- tests/js/report/
cache:
untracked: true
when: always
paths:
- tests/js/screenshots/
- tests/js/screens/
- tests/js/report/
- storage/
- vendor/ #composer packages
- node_modules
- public
但是系统找不到start-selenium-standalone.sh,在原来的docker映像中它在/opt/bin
中我如何启动它?
我写了下一个Dockerfile并使用它们:
Dockerfile
FROM ubuntu:latest
FROM node:14.15.0-stretch AS node
RUN npm i libnpx
FROM selenium/standalone-chrome:latest as sel
USER root
#selenium copy
#COPY --from=sel /opt/bin/start-selenium-standalone.sh /opt/bin/start-selenium-standalone.sh
#COPY --from=sel /etc/supervisor/conf.d/ /etc/supervisor/conf.d/
#COPY --from=sel /opt/bin/generate_config /opt/bin/generate_config
#COPY --from=sel /opt/selenium/config.toml /opt/selenium/config.toml
#COPY --from=sel /opt/selenium/browser_name /opt/selenium/browser_name
#ENV SE_RELAX_CHECKS true
EXPOSE 4444
EXPOSE 7900
#Nodejs
#COPY --from=node / /
COPY --from=node /usr/local/lib/ /usr/local/lib/
COPY --from=node /usr/local/bin/ /usr/local/bin/
COPY --from=node /usr/local/bin/ /usr/local/bin/
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
LABEL miekrif uzvar-selenium
CMD ["bash"]
在以下工作中:
test-dev:
stage: test
image: miekrif/uzavr-selenium:latest
script:
- nohup /opt/bin/entry_point.sh &
- npx mocha tests/js/screenshots-* --timeout 50000
- npx playwright test tests/js/pw_*
- php artisan test
artifacts:
when: always
name: $CI_COMMIT_SHA
untracked: true
paths:
- tests/js/screenshots/
- tests/js/screens/
- tests/js/report/
cache:
untracked: true
when: always
paths:
- tests/js/screenshots/
- tests/js/screens/
- tests/js/report/
- storage/
- vendor/ #composer packages
- node_modules
- public
tags:
- test_new_runner
only:
- ned_runner #Затычка бранча чтобы ранер не запускался
# - develop