This tutorial will show you how to create a simple Java web application using embedded Tomcat.
- Basic Java knowledge, including an installed version of the JVM and Maven.
- Basic Git knowledge, including an installed version of Git.
- A Java web application. If you don't have one follow the first step to create an example. Otherwise skip that step.
If you want to skip the creation steps you can clone the finished sample and then skip to the 'Deploy Your Application to Heroku' section:
$ git clone git@github.com:heroku/devcenter-embedded-tomcat.git
If you would like to create the application yourself, then follow the Dev Center guide on how to Create a Java Web Application using Embedded Tomcat.
mvn package
からの
sh target/bin/webapp
-- または Spring Boot で起動 --
mvn spring-boot:run
もしくは
mvn package java -jar target/embeddedTomcatSample-1.0-SNAPSHOT.jar
(Heroku 環境変数 PORT を参照します)
-- Docker (local) --
docker build -t embeddedtomcatsample:latest .
docker run -p 8080:8080 -e PORT=8080 embeddedtomcatsample:latest
-- CI --
A basic GitHub Actions workflow has been added at .github/workflows/ci.yml to build the project and (optionally) build a Docker image.