这似乎是一个相当简单的问题,但我无法让它发挥作用。
我需要加载我的MySQL数据库以运行我的E2E测试。这是我试过的
试验1:
image: openjdk:8
services:
- mysql:latest
...
...
...
e2e_tests:
before_script:
# install chrome
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
- apt-get update
- apt-get install -y google-chrome-stable xvfb
- rm -rf /var/lib/apt/lists/*
- apt-get --assume-yes install mysql-client
Chrome安装正常进行,但对于MySQL,它说: E:无法找到包mysql-client
试验2:
image: openjdk:8
services:
- mysql:latest
...
...
...
e2e_tests:
before_script:
# install chrome
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
- apt-get update
- apt-get install -y google-chrome-stable xvfb
- rm -rf /var/lib/apt/lists/*
- cat "./DB/mysqlDumpFile.sql | docker exec -i mysql /usr/bin/mysql -u $DB_USERNAME --password=$MYSQL_ROOT_PASSWORD $MYSQL_DATABASE"
它说:找不到Docker命令
我确信如果我更改基本图像可能会有效。但是改变基本映像只是加载MySQL似乎有点过分了。有没有简单的方法让这个工作。
解决方案1:
image: openjdk:8
services:
- mysql:latest
...
...
...
e2e_tests:
before_script:
# install chrome
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
- apt-get update
- apt-get install -y google-chrome-stable xvfb
# install mysql
- wget https://dev.mysql.com/get/mysql-apt-config_0.8.8-1_all.deb
- dpkg -i mysql-apt-config_0.8.8-1_all.deb
- apt-get update
- apt-get install -y mysql-client