- Mysql (local)
docker run -d \
--name mysql \
--rm \
-e MYSQL_ROOT_PASSWORD=root_pwd \
-p 3306:3306 \
mysql
application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/api?createDatabaseIfNotExist=true
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
.env
DATABASE_URL=jdbc:mysql://localhost:3306/api?createDatabaseIfNotExist=true
DATABASE_USER=root
DATABASE_PWD=root_pwd
- load .env
export $(cat .env | xargs)
- run
mvn spring-boot:run -Dspring-boot.run.profiles=prd
- build
docker build -t ecommerce .
- run
docker run -d \
--network host \
-p 8080:8080 \
-e PROFILE=dev \
-e DATABASE_URL=jdbc:mysql://localhost:3306/api?createDatabaseIfNotExist=true \
-e DATABASE_USER=root \
-e DATABASE_PWD=root_pwd \
ecommerce