背景介绍
创建一个Spring Boot项目,Spring Boot项目中使用到MySQL数据库和Redis缓存,通过Docker部署到阿里云服务器(云服务器默认已经安装了Docker)
软件环境
- 云服务器环境:Alibaba Cloul Linux release 3
- Docker版本:25.0.0
- Docker Compose版本:v2.14.2
- Spring Boot版本:2.7.18
- Maven版本:3.8.1
操作步骤
- 初始化项目框架:https://start.aliyun.com/
- 配置本地maven仓库:设置本地和中央仓库地址,中央仓库可配置阿里云仓库地址(https://maven.aliyun.com/nexus/content/repositories/central/)
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
| This is the configuration file for Maven. It can be specified at two levels:
|
| 1. User Level. This settings.xml file provides configuration for a single user,
| and is normally provided in ${user.home}/.m2/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -s /path/to/user/settings.xml
|
| 2. Global Level. This settings.xml file provides configuration for all Maven
| users on a machine (assuming they're all using the same Maven
| installation). It's normally provided in
| ${maven.home}/conf/settings.xml.
|
| NOTE: This location can be overridden