logo
0
0
Login
docs: 修改文档地址

Spring Boot + Maven + Docker

badge badge badge

In this example:

  • Using Cloud Native Build to package Spring Boot + Maven project, build Docker image and publish to artifact repository
  • Configured settings.xml to use Tencent Cloud's Maven Mirror for acceleration

Prerequisites

  1. Use Cloud Native Build (CNB) to build your project
  2. Write a Dockerfile
  3. Declarative build cache
  4. Understand environment variables and their usage
  5. Learn how to use Docker artifact repository
  6. Configure .ide/Dockerfile for Cloud Native Development

Configure Tencent Cloud Maven Mirror and Private Repository

  • Please refer to: settings.xml and pom.xml in the repository, which contain corresponding comments
  • Build commands:
    • Build: mvn package -s ./settings.xml (actual command may vary)
    • Publish Maven package: mvn deploy -s ./settings.xml (actual command may vary)
    • If the configured Mirror doesn't take effect, try replacing -s with -gs, e.g. mvn package -gs ./settings.xml

Quick Start

Run Service

  1. Command line execution
# Run in terminal $ mvn spring-boot:run
  1. Debug Mode
  • Click the "Run and Debug" icon in the activity bar on the left side of VS Code, select "Launch file" from the run and debug drop-down list, and then click the green run button (or press F5 directly). View configuration