我有一个带有mysql入口点的docker-compose.yml文件,该文件正在工作, 我需要将相同的入口点文件输入到gitlab服务入口点。
Gitlab yml文件示例。
.
.
.
stage: test
services:
- name: mysql:latest
entrypoint: ["sh -c", "echo 'CREATE DATABASE IF NOT EXISTS databaseOne; CREATE DATABASE IF NOT EXISTS databaseTwo; CREATE DATABASE IF NOT EXISTS databaseThree; ALTER USER \"root\"@\"%\" IDENTIFIED WITH mysql_native_password BY \"admin\";' > /docker-entrypoint-initdb.d/init.sql;
/usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"]```
docker-compose.yml file
version: '3'
services:
mysql:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: admin
entrypoint:
sh -c "
echo 'CREATE DATABASE IF NOT EXISTS databaseOne; CREATE DATABASE IF NOT EXISTS databaseTwo; CREATE DATABASE IF NOT EXISTS databaseThree; ALTER USER \"root\"@\"%\" IDENTIFIED WITH mysql_native_password BY \"admin\";' > /docker-entrypoint-initdb.d/init.sql;
/usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"```