# react-java-mysql **Repository Path**: lou_jianyang/react-java-mysql ## Basic Information - **Project Name**: react-java-mysql - **Description**: docker-compose示例项目 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2023-04-10 - **Last Updated**: 2024-04-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README <<<<<<< HEAD ## Compose sample application ### Use with Docker Development Environments You can open this sample in the Dev Environments feature of Docker Desktop version 4.12 or later. [Open in Docker Dev Environments Open in Docker Dev Environments](https://open.docker.com/dashboard/dev-envs?url=https://github.com/docker/awesome-compose/tree/master/react-java-mysql) ### React application with a Spring backend and a MySQL database Project structure: ``` . ├── backend │   ├── Dockerfile │   ... ├── db │   └── password.txt ├── compose.yaml ├── frontend │   ├── ... │   └── Dockerfile └── README.md ``` [_compose.yaml_](compose.yaml) ``` services: backend: build: backend ... db: # We use a mariadb image which supports both amd64 & arm64 architecture image: mariadb:10.6.4-focal # If you really want to use MySQL, uncomment the following line #image: mysql:8.0.27 ... frontend: build: frontend ports: - 3000:3000 ... ``` The compose file defines an application with three services `frontend`, `backend` and `db`. When deploying the application, docker compose maps port 3000 of the frontend service container to port 3000 of the host as specified in the file. Make sure port 3000 on the host is not already being in use. > ℹ️ **_INFO_** > For compatibility purpose between `AMD64` and `ARM64` architecture, we use a MariaDB as database instead of MySQL. > You still can use the MySQL image by uncommenting the following line in the Compose file > `#image: mysql:8.0.27` ## Deploy with docker compose ``` $ docker compose up -d Creating network "react-java-mysql-default" with the default driver Building backend Step 1/17 : FROM maven:3.6.3-jdk-11 AS builder ... Successfully tagged react-java-mysql_frontend:latest WARNING: Image for service frontend was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. Creating react-java-mysql-frontend-1 ... done Creating react-java-mysql-db-1 ... done Creating react-java-mysql-backend-1 ... done ``` ## Expected result Listing containers must show three containers running and the port mapping as below: ``` $ docker ps ONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a63dee74d79e react-java-mysql-backend "java -Djava.securit…" 39 seconds ago Up 37 seconds react-java-mysql_backend-1 6a7364c0812e react-java-mysql-frontend "docker-entrypoint.s…" 39 seconds ago Up 33 seconds 0.0.0.0:3000->3000/tcp react-java-mysql_frontend-1 b176b18fbec4 mysql:8.0.19 "docker-entrypoint.s…" 39 seconds ago Up 37 seconds 3306/tcp, 33060/tcp react-java-mysql_db-1 ``` After the application starts, navigate to `http://localhost:3000` in your web browser to get a colorful message. ![page](./output.jpg) Stop and remove the containers ``` $ docker compose down Stopping react-java-mysql-backend-1 ... done Stopping react-java-mysql-frontend-1 ... done Stopping react-java-mysql-db-1 ... done Removing react-java-mysql-backend-1 ... done Removing react-java-mysql-frontend-1 ... done Removing react-java-mysql-db-1 ... done Removing network react-java-mysql-default ``` ======= # react-java-mysql #### 介绍 docker-compose示例项目 #### 软件架构 软件架构说明 #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) >>>>>>> 1bf21223ef0ea0016782636bf2d642bf477a514f