mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
(improvement)(build) Use docker-compose.yml to run the entire process successfully. (#1298)
This commit is contained in:
@@ -9,7 +9,7 @@ ARG SUPERSONIC_VERSION
|
|||||||
|
|
||||||
# Install necessary packages, including MySQL client
|
# Install necessary packages, including MySQL client
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y mysql-client unzip && \
|
apt-get install -y default-mysql-client unzip && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy the supersonic standalone zip file into the container
|
# Copy the supersonic standalone zip file into the container
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ services:
|
|||||||
container_name: supersonic_mysql
|
container_name: supersonic_mysql
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: root_password
|
MYSQL_ROOT_PASSWORD: root_password
|
||||||
|
MYSQL_DB_HOST: ${DB_HOST}
|
||||||
MYSQL_DATABASE: ${DB_NAME}
|
MYSQL_DATABASE: ${DB_NAME}
|
||||||
MYSQL_USER: ${DB_USERNAME}
|
MYSQL_USER: ${DB_USERNAME}
|
||||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||||
@@ -29,17 +30,13 @@ services:
|
|||||||
command: >
|
command: >
|
||||||
sh -c "
|
sh -c "
|
||||||
sleep 30 &&
|
sleep 30 &&
|
||||||
if ! mysql -h mysql -u${DB_USERNAME} -p${DB_PASSWORD} -e 'use ${DB_NAME}; show tables;' | grep -q 's2_database'; then
|
if ! mysql -h supersonic_mysql -uroot -proot_password -e 'use supersonic_db; show tables;' | grep -q 's2_database'; then
|
||||||
mysql -h mysql -u${DB_USERNAME} -p${DB_PASSWORD} ${DB_NAME} < /usr/src/app/supersonic-standalone-0.9.2-SNAPSHOT/conf/schema-mysql.sql &&
|
mysql -h supersonic_mysql -uroot -proot_password supersonic_db < /usr/src/app/supersonic-standalone-0.9.2-SNAPSHOT/conf/db/schema-mysql.sql &&
|
||||||
mysql -h mysql -u${DB_USERNAME} -p${DB_PASSWORD} ${DB_NAME} < /usr/src/app/supersonic-standalone-0.9.2-SNAPSHOT/conf/data-mysql.sql
|
mysql -h supersonic_mysql -uroot -proot_password supersonic_db < /usr/src/app/supersonic-standalone-0.9.2-SNAPSHOT/conf/db/data-mysql.sql
|
||||||
else
|
else
|
||||||
echo 'Database already initialized.'
|
echo 'Database already initialized.'
|
||||||
fi
|
fi
|
||||||
"
|
"
|
||||||
environment:
|
|
||||||
DB_NAME: supersonic_db
|
|
||||||
DB_USERNAME: supersonic_user
|
|
||||||
DB_PASSWORD: supersonic_password
|
|
||||||
dns:
|
dns:
|
||||||
- 8.8.8.8
|
- 8.8.8.8
|
||||||
- 8.8.4.4
|
- 8.8.4.4
|
||||||
@@ -55,11 +52,11 @@ services:
|
|||||||
- 8.8.8.8
|
- 8.8.8.8
|
||||||
- 8.8.4.4
|
- 8.8.4.4
|
||||||
|
|
||||||
|
|
||||||
java_backend:
|
java_backend:
|
||||||
image: supersonic:0.9.2-SNAPSHOT
|
image: supersonic:0.9.2-SNAPSHOT
|
||||||
container_name: supersonic_java_backend
|
container_name: supersonic_java_backend
|
||||||
environment:
|
environment:
|
||||||
|
DB_HOST: supersonic_mysql
|
||||||
DB_NAME: supersonic_db
|
DB_NAME: supersonic_db
|
||||||
DB_USERNAME: supersonic_user
|
DB_USERNAME: supersonic_user
|
||||||
DB_PASSWORD: supersonic_password
|
DB_PASSWORD: supersonic_password
|
||||||
|
|||||||
@@ -6,17 +6,11 @@ server:
|
|||||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
h2:
|
|
||||||
console:
|
|
||||||
path: /h2-console/semantic
|
|
||||||
enabled: true
|
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: org.h2.Driver
|
url: jdbc:mysql://${DB_HOST}:3306/${DB_NAME}?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
||||||
schema: classpath:db/schema-h2.sql
|
username: ${DB_USERNAME}
|
||||||
data: classpath:db/data-h2.sql
|
password: ${DB_PASSWORD}
|
||||||
url: jdbc:h2:mem:semantic;DATABASE_TO_UPPER=false
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
username: root
|
|
||||||
password: semantic
|
|
||||||
|
|
||||||
mybatis:
|
mybatis:
|
||||||
mapper-locations=classpath:mappers/custom/*.xml,classpath*:/mappers/*.xml
|
mapper-locations=classpath:mappers/custom/*.xml,classpath*:/mappers/*.xml
|
||||||
|
|||||||
Reference in New Issue
Block a user