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:
Source code
Terminal
./mvnw clean package -Pproduction
Terminal
PowerShell
PowerShell
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
.
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
The walking skeleton includes a Dockerfile
that allows you to package your application as a Docker image.
Important
|
Install Docker
You must install Docker on your system before you can build an image.
|
Run the following command from your project root to build the image:
Source code
terminal
docker build -t my-application:latest .
This command builds your application in production mode and produces a Docker image tagged my-application:latest
.