Build a Project
Up to this point, the walking skeleton has been running in development mode. Once you’ve added meaningful features, you can deploy your application to production. To do that, you have to make a production build. The build gathers necessary frontend resources and dependencies. It then transpiles, minimizes and bundles them to make the application load faster.
Make a Production Build
In the walking skeleton, you use the Vaadin Maven plugin to make a production build. You do this by activating the production
profile, like this:
./mvnw clean package -Pproduction
Once the build has finished, check the target
directory. If your skeleton was named my-application
, you should find a file called my-application-1.0-SNAPSHOT.jar
.
Important
| Running this JAR directly will fail due to a missing production database. The skeleton uses H2 or PostgreSQL Testcontainers in development mode but expects PostgreSQL in production. You’ll learn how to address this later in this guide. |
The production
profile not only builds the frontend, but also excludes the development server bundle since it contains features that aren’t used in production.
Build a Docker Image
Starting with Vaadin 24.8, the walking skeleton includes a Dockerfile
that allows you to package your application as a Docker image.
Note
|
Install Docker
You must install Docker on your system before you can build an image.
|
After creating a production build, run the following command from your project root:
docker build -t my-application:latest .
This command produces a Docker image tagged my-application:latest
, including the JAR file from the target
directory.
Deploy with Control Center
Once the Docker image is built, you can deploy it using Control Center, a tool designed to simplify managing Vaadin applications on Kubernetes clusters.
Note
|
Install Control Center
You must first install Control Center into a Kubernetes cluster. This cluster can be local or cloud-based. For installation instructions, see the Getting Started guide.
|
The walking skeleton is preconfigured to work with Control Center. Specifically, it requires the following features to be enabled for the application to run in production without modification:
-
Identity Management via Keycloak for authentication and user management.
-
PostgreSQL Database provisioned through the Control Center UI.
If you choose not to use these features, you’ll need to manually adjust the application’s configuration to work with a different authentication mechanism or database setup.
For full deployment instructions, see the Application Deployment guide.