Simple dockerized Maven project with Java 8.
mvn -B archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=com.mycompany.myapp \
-DartifactId=myapp
mvn install
mvn exec:java
docker build --no-cache --rm --tag=myapp .
docker run --publish 4567:4567 --rm --name=myapp myapp mvn exec:java
Inside docker-compose.yml
:
myapp:
build: .
command: mvn exec:java
ports:
- "4567:4567"
Run it with:
docker-compose up -d