feat: docker setup

This commit is contained in:
filippo-ferrari 2024-09-06 18:54:26 +02:00
parent c3be3ac050
commit f912fab9e6
4 changed files with 38 additions and 16 deletions

2
.gitignore vendored
View file

@ -4,6 +4,8 @@
.settings
.project
.classpath
.env
application.properties
*.iml
.DS_Store

13
Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM openjdk:21-jdk-slim
# Set the working directory
WORKDIR /app
# Copy the JAR file into the container
COPY target/munera-1.0-SNAPSHOT.jar /app/munera-1.0-SNAPSHOT.jar
# Expose the port the app runs on
EXPOSE 8080
# Run the JAR file
CMD ["java", "-jar", "/app/munera-1.0-SNAPSHOT.jar"]

23
docker-compose.yml Normal file
View file

@ -0,0 +1,23 @@
version: '3.8'
services:
vaadin-app:
image: vaadin-app
build: .
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: ${DB_ADDRESS}
SPRING_DATASOURCE_USERNAME: ${DB_USER}
SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD}
depends_on:
- db
db:
image: postgres:13
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
- "5432:5432"

View file

@ -1,16 +0,0 @@
server.port=${PORT:8080}
logging.level.org.atmosphere = warn
spring.mustache.check-template-location = false
# Launch the default browser when starting the application in development mode
#vaadin.launch-browser=true
# PostgreSQL configuration.
spring.datasource.url = jdbc:postgresql://localhost:5432/munera_vaadin
spring.datasource.username = postgres
spring.datasource.password =
spring.jpa.hibernate.ddl-auto = update
# 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.application.munera
spring.jpa.defer-datasource-initialization = true
spring.sql.init.mode = always