Added build with tomcat docker image

This commit is contained in:
Clemens 2024-06-18 16:05:27 +02:00
parent e9bc625676
commit 04379c9091
5 changed files with 25 additions and 2 deletions

7
Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM gradle:jdk17-jammy as build
WORKDIR /home/gradle/ModeratorElection
COPY . /home/gradle/ModeratorElection
RUN ./gradlew -Dvaadin.productionMode=true -Dvaadin.force.production.build=true -Pproduction clean war
FROM tomcat:11.0
COPY --from=build home/gradle/ModeratorElection/build/libs/ModeratorElection-plain.war /usr/local/tomcat/webapps/ROOT.war

View file

@ -10,6 +10,7 @@ plugins {
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
id 'com.vaadin'
id 'war'
}
repositories {
@ -32,6 +33,7 @@ dependencies {
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
}
dependencyManagement {
@ -40,6 +42,10 @@ dependencyManagement {
}
}
war {
enabled=true
}
test{
useJUnitPlatform()
}

2
build.sh Normal file
View file

@ -0,0 +1,2 @@
#!/bin/bash
docker image build . -t moderator

View file

@ -2,9 +2,17 @@ package com.ModeratorElection;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication
public class MEApplication {
public class MEApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MEApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(MEApplication.class, args);
}

View file

@ -6,6 +6,6 @@ spring.mustache.check-template-location = false
vaadin.launch-browser=true
# To improve the performance during development.
# For more information https://vaadin.com/docs/latest/integrations/spring/configuration#special-configuration-parameters
vaadin.allowed-packages = com.vaadin,org.vaadin,dev.hilla,com.example.application
vaadin.allowed-packages = com.vaadin,org.vaadin,dev.hilla,com.ModeratorElection.ModeratorElection.ModeratorElectionApplication
spring.jpa.defer-datasource-initialization = true
membernames=${MEMBERNAMES:Micha,Ansgar,Clemens,Mattis,Erik,Mirco}