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
|
||||
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/*
|
||||
|
||||
# Copy the supersonic standalone zip file into the container
|
||||
|
||||
@@ -6,6 +6,7 @@ services:
|
||||
container_name: supersonic_mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root_password
|
||||
MYSQL_DB_HOST: ${DB_HOST}
|
||||
MYSQL_DATABASE: ${DB_NAME}
|
||||
MYSQL_USER: ${DB_USERNAME}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
@@ -29,17 +30,13 @@ services:
|
||||
command: >
|
||||
sh -c "
|
||||
sleep 30 &&
|
||||
if ! mysql -h mysql -u${DB_USERNAME} -p${DB_PASSWORD} -e 'use ${DB_NAME}; 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 mysql -u${DB_USERNAME} -p${DB_PASSWORD} ${DB_NAME} < /usr/src/app/supersonic-standalone-0.9.2-SNAPSHOT/conf/data-mysql.sql
|
||||
if ! mysql -h supersonic_mysql -uroot -proot_password -e 'use supersonic_db; show tables;' | grep -q 's2_database'; then
|
||||
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 supersonic_mysql -uroot -proot_password supersonic_db < /usr/src/app/supersonic-standalone-0.9.2-SNAPSHOT/conf/db/data-mysql.sql
|
||||
else
|
||||
echo 'Database already initialized.'
|
||||
fi
|
||||
"
|
||||
environment:
|
||||
DB_NAME: supersonic_db
|
||||
DB_USERNAME: supersonic_user
|
||||
DB_PASSWORD: supersonic_password
|
||||
dns:
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
@@ -55,11 +52,11 @@ services:
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
|
||||
|
||||
java_backend:
|
||||
image: supersonic:0.9.2-SNAPSHOT
|
||||
container_name: supersonic_java_backend
|
||||
environment:
|
||||
DB_HOST: supersonic_mysql
|
||||
DB_NAME: supersonic_db
|
||||
DB_USERNAME: supersonic_user
|
||||
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/*
|
||||
|
||||
spring:
|
||||
h2:
|
||||
console:
|
||||
path: /h2-console/semantic
|
||||
enabled: true
|
||||
datasource:
|
||||
driver-class-name: org.h2.Driver
|
||||
schema: classpath:db/schema-h2.sql
|
||||
data: classpath:db/data-h2.sql
|
||||
url: jdbc:h2:mem:semantic;DATABASE_TO_UPPER=false
|
||||
username: root
|
||||
password: semantic
|
||||
url: jdbc:mysql://${DB_HOST}:3306/${DB_NAME}?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USERNAME}
|
||||
password: ${DB_PASSWORD}
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
|
||||
mybatis:
|
||||
mapper-locations=classpath:mappers/custom/*.xml,classpath*:/mappers/*.xml
|
||||
|
||||
Reference in New Issue
Block a user