From 4bdc4df9dde62f0de2989891de36f698d198f46f Mon Sep 17 00:00:00 2001 From: dhirsch1 Date: Tue, 15 Aug 2023 11:38:00 +0300 Subject: [PATCH] adding required config --- Dockerfile | 13 +++++++++++++ config/contrast_security.yaml | 6 ++++++ docker-compose.yml | 16 ++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 Dockerfile create mode 100644 config/contrast_security.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..1efc5cf80 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM openjdk:17.0.1-slim +WORKDIR /opt +ENV PORT 8080 +ENV POSTGRES_USER petclinic +ENV POSTGRES_PASSWORD petclinic +ENV POSTGRES_URL jdbc:postgresql://postgres/petclinic +ENV JAVA_OPTS "-Dspring.profiles.active=postgres -Xmx2g" +EXPOSE 8080 +COPY target/*.jar /opt/app.jar +COPY --from=contrast/agent-java:latest /contrast/contrast-agent.jar /opt/contrast/contrast.jar +COPY config/contrast_security.yaml /opt/contrast/contrast_security.yaml +ENV JAVA_TOOL_OPTIONS "-javaagent:/opt/contrast/contrast.jar -Dcontrast.config.path=/opt/contrast/contrast_security.yaml" +ENTRYPOINT exec java ${JAVA_OPTS} -jar app.jar diff --git a/config/contrast_security.yaml b/config/contrast_security.yaml new file mode 100644 index 000000000..4db9935a5 --- /dev/null +++ b/config/contrast_security.yaml @@ -0,0 +1,6 @@ +agent: + java: + scan_all_classes: false + scan_all_code_sources: false + logger: + stdout: true diff --git a/docker-compose.yml b/docker-compose.yml index f949dc915..6ccc8c87f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,3 +25,19 @@ services: - POSTGRES_DB=petclinic profiles: - postgres + petclinic: + # image: spring-petclinic:3.1.0-SNAPSHOT + image: mypetclinic + ports: + - "8080:8080" + environment: + - CONTRAST__API__API_KEY=${CONTRAST__API__API_KEY} + - CONTRAST__API__SERVICE_KEY=${CONTRAST__API__SERVICE_KEY} + - CONTRAST__API__USER_NAME=${CONTRAST__API__USER_NAME} + - CONTRAST__API__URL=https://intuit.contrastsecurity.com/Contrast + depends_on: + - mysql + - postgres + profiles: + - mysql + - postgres