|
| 1 | +# Step 5: Containerize Applications |
| 2 | + |
| 3 | +## 🎯 Goal |
| 4 | + |
| 5 | +Prepare your modernized application for cloud deployment by containerizing both the web and worker modules using a natural language prompt in Copilot CLI. |
| 6 | + |
| 7 | +## Run the Containerization Task |
| 8 | + |
| 9 | +1. Inside the running Copilot CLI session, enter the following prompt: |
| 10 | + |
| 11 | + ``` |
| 12 | + Containerize this application. Generate optimized Dockerfiles for each module with multi-stage builds, build the Docker images, and fix any build errors. |
| 13 | + ``` |
| 14 | + |
| 15 | +2. Copilot will analyze the workspace and generate a containerization plan. Allow Copilot to proceed through each step, including running commands to build Docker images. |
| 16 | + |
| 17 | +3. When the task completes, review the generated `Dockerfile` files for both the `web` and `worker` modules. |
| 18 | + |
| 19 | +## What This Does |
| 20 | + |
| 21 | +The containerization process will: |
| 22 | +- Analyze the project structure (web module + worker module) |
| 23 | +- Generate optimized `Dockerfile` for each module |
| 24 | +- Configure multi-stage builds for smaller image sizes |
| 25 | +- Set up proper Java runtime configurations |
| 26 | +- Build and test the Docker images locally |
| 27 | + |
| 28 | +## ✅ Checkpoint |
| 29 | + |
| 30 | +- [ ] Containerization prompt executed in Copilot CLI |
| 31 | +- [ ] Dockerfiles generated for both web and worker modules |
| 32 | +- [ ] Docker images built successfully |
| 33 | + |
| 34 | +## 🎉 Congratulations! |
| 35 | + |
| 36 | +You've completed the App Modernization workshop using the Copilot CLI! Here's what you accomplished: |
| 37 | + |
| 38 | +- ✅ **Set up** Copilot CLI with the modernization MCP server |
| 39 | +- ✅ **Upgraded** from Java 8 → 21 and Spring Boot 2.x → 3.x |
| 40 | +- ✅ **Added health endpoints** using Spring Boot Actuator |
| 41 | +- ✅ **Containerized** the application for cloud deployment |
| 42 | + |
| 43 | +### What's Next? |
| 44 | + |
| 45 | +- Deploy your containerized app to **Azure Container Apps** — try the prompt: `Deploy this application to Azure` |
| 46 | +- Explore more [GitHub Copilot app modernization via CLI](https://learn.microsoft.com/en-us/azure/developer/java/migration/github-copilot-app-modernization-for-java-copilot-cli) features |
| 47 | +- Check out the [Copilot Prompts Guide](../PROMPTS.md) for additional prompts used during development |
| 48 | +- Visit the other [Copilot Dev Days workshops](https://github.com/copilot-dev-days) |
0 commit comments