diff --git a/SpringDataPlatform/README.md b/SpringDataPlatform/README.md index fb7d643cc..783b1be31 100644 --- a/SpringDataPlatform/README.md +++ b/SpringDataPlatform/README.md @@ -53,6 +53,19 @@ ARCHITECTURE : ```bash docker-compose up + +#-------------------------- +# Macbook m1 +#-------------------------- + +# run +docker-compose -f docker-compose-m1.yml up + +# rebuild (use updated java code) and run +docker-compose -f docker-compose-m1.yml up --build + +# restart +docker-compose -f docker-compose-m1.yml restart ``` diff --git a/SpringDataPlatform/docker-compose-m1.yml b/SpringDataPlatform/docker-compose-m1.yml new file mode 100644 index 000000000..a988348bb --- /dev/null +++ b/SpringDataPlatform/docker-compose-m1.yml @@ -0,0 +1,66 @@ +version: '3' +services: + app: + restart: always + build: ./backend/DataPlatform + working_dir: /app + volumes: + - ./backend/DataPlatform:/app + ports: + - "9999:9999" + platform: linux/amd64 + environment: + - SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/data_platform + - SPRING_DATASOURCE_USERNAME=root + - SPRING_DATASOURCE_PASSWORD= + - SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.cj.jdbc.Driver + - SPRING_JPA_SHOW_SQL=true + - SPRING_JPA_HIBERNATE_DDL_AUTO=create # Set the Hibernate ddl-auto property here + - SPRING_JPA_GENERATE_DDL=true + #- JAVA_HOME=/usr/local/openjdk-11 + depends_on: + - mysql + command: mvn clean spring-boot:run -DskipTests + + vue: + restart: always + build: ./frontend/data-platform-ui + working_dir: /app + platform: linux/amd64 + ports: + - "8080:8080" # Map host port 8080 to container port 8080 + volumes: + - ./frontend/data-platform-ui:/app # Mount the current directory into the container + command: npm run serve + + mysql: + image: mysql:5.7 + restart: always + platform: linux/amd64 + environment: + #https://stackoverflow.com/questions/66831863/mysql-docker-container-keeps-restarting + #MYSQL_USER: root # NO NEED to create root user, since it is created automatically + MYSQL_DATABASE: data_platform + MYSQL_ROOT_PASSWORD: + MYSQL_ALLOW_EMPTY_PASSWORD: "yes" + ports: + - "3306:3306" + volumes: + - mysql-data:/var/lib/mysql + + nginx: + image: nginx + restart: always + platform: linux/amd64 + ports: + #- "8080:80" + - "8081:8081" + volumes: + - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro + - ./nginx/index.html:/app/html:ro + depends_on: + - app + #- app2 + +volumes: + mysql-data: \ No newline at end of file