diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..55cad0b0eecc022c38004b957742450c4f30669f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +# ------------------------------------------------------------------------------ +# Copyright (C) 2021 European Spallation Source ERIC. +# ------------------------------------------------------------------------------ + +FROM openjdk:17 + +# deployment unit +COPY target/naming-backend-0.0.1-SNAPSHOT.jar /naming/naming-backend-0.0.1-SNAPSHOT.jar + +CMD ["java", "-jar", "/naming/naming-backend-0.0.1-SNAPSHOT.jar", "--spring.config.name=application-docker"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..423f76babc9942197182a6eb2325ec9bd02d1e09 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +# ------------------------------------------------------------------------------ +# Copyright (C) 2022 European Spallation Source ERIC. +# ------------------------------------------------------------------------------ + +version: '3.7' +services: + naming: + build: ./ + ports: + - "8080:8083" + depends_on: + - postgres + command: "java -jar /naming/naming-backend-0.0.1-SNAPSHOT.jar" + + postgres: + container_name: "postgres" + image: "postgres:9.6.7" + ports: + - "5432:5432" + environment: + POSTGRES_DB: discs_names + POSTGRES_USER: discs_names + POSTGRES_PASSWORD: discs_names + PGDATA: /var/lib/postgresql/data/pgdata + volumes: + - naming-data:/var/lib/postgresql/data/pgdata + +volumes: + naming-data: diff --git a/src/main/resources/application-docker.properties b/src/main/resources/application-docker.properties new file mode 100644 index 0000000000000000000000000000000000000000..f21cd21557e834386bff48e2c94f03138bf4ade1 --- /dev/null +++ b/src/main/resources/application-docker.properties @@ -0,0 +1,14 @@ + +server.port=8083 + +spring.profiles.active=@spring.profiles.active@ + +# ------------------------------------------------------------ + +spring.datasource.url=jdbc:postgresql://postgres:5432/discs_names +spring.datasource.username=discs_names +spring.datasource.password=discs_names + +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +spring.jpa.hibernate.ddl-auto=none +spring.jpa.hibernate.show-sql=true diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f21cd21557e834386bff48e2c94f03138bf4ade1 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -0,0 +1,14 @@ + +server.port=8083 + +spring.profiles.active=@spring.profiles.active@ + +# ------------------------------------------------------------ + +spring.datasource.url=jdbc:postgresql://postgres:5432/discs_names +spring.datasource.username=discs_names +spring.datasource.password=discs_names + +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +spring.jpa.hibernate.ddl-auto=none +spring.jpa.hibernate.show-sql=true