Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chainguard test #711

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
## Use AWS AL2 + Corretto base image
FROM amazoncorretto:17-al2-jdk

## Use chainguard dev base image can be used for local devs
FROM cgr.dev/cms-cpt-gdit/jdk:openjdk-17-dev AS build_dev_env
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar

#Update Packages
#RUN yum update -y --security
USER root
RUN apk add coreutils curl

## Add the wait script to the image
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait
RUN chmod +x /wait
COPY --from=ghcr.io/ufoscout/docker-compose-wait:latest /wait /wait

## Download new relic java agent
RUN curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic.jar \
&& curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic.yml

USER java
ENTRYPOINT ["java","-jar","-Dspring.profiles.active=it", "app.jar"]


FROM cgr.dev/cms-cpt-gdit/jdk:openjdk-17 AS prod
USER java
ARG JAR_FILE=target/*.jar
COPY --chown=java:java ${JAR_FILE} app.jar

COPY --from=ghcr.io/ufoscout/docker-compose-wait:latest --chown=java:java /wait /wait
COPY --from=build_dev_env --chown=java:java /home/build/newrelic.jar ./newrelic.jar
COPY --from=build_dev_env --chown=java:java /home/build/newrelic.yml ./newrelic.yml

## Launch the wait tool and then your application
ENTRYPOINT ["java","-jar","-Dspring.profiles.active=it", "app.jar"]
Loading