@@ -120,68 +120,13 @@ RUN mv /dist/app/src /dist-dev/src && \
120120COPY --from=maven-build /app/gitops-playground.jar /dist-dev/gitops-playground.jar
121121# Remove compiled GOP code from jar to avoid duplicate in dev image, allowing for scripting.
122122# Keep generated class Version, to avoid ClassNotFoundException.
123- RUN zip -d /dist-dev/gitops-playground.jar 'com/cloudogu/gitops/*' -x com/cloudogu/gitops/cli/Version.class
123+ # RUN zip -d /dist-dev/gitops-playground.jar 'com/cloudogu/gitops/*' -x com/cloudogu/gitops/cli/Version.class
124124
125125# Required to prevent Java exceptions resulting from AccessDeniedException by jgit when running arbitrary user
126126RUN mkdir -p /dist/root/.config/jgit
127127RUN touch /dist/root/.config/jgit/config
128128RUN chmod +r /dist/root/ && chmod g+rw /dist/root/.config/jgit/
129129
130- # This stage builds a static binary using graal VM. For details see docs/developers.md#GraalVM
131- FROM graal AS native-image
132- ENV MAVEN_OPTS='-Dmaven.repo.local=/mvn'
133- RUN microdnf install gnupg
134-
135- # Provide binaries used by apply-ng, so our runs with native-image-agent dont fail
136- # with "java.io.IOException: Cannot run program "kubectl"..." etc.
137- RUN microdnf install iproute
138-
139- WORKDIR /app
140-
141- # Copy only binaries, not jenkins plugins. Avoids having to rebuild native image only plugin changes
142- COPY --from=downloader /dist/usr/ /usr/
143- COPY --from=downloader /dist/app/ /app/
144- # copy only resources that we need to compile the binary
145- COPY --from=maven-build /app/gitops-playground.jar /app/
146-
147- # Create Graal native image config
148- RUN java -agentlib:native-image-agent=config-output-dir=conf/ -jar gitops-playground.jar || true
149- # Run again with different params in order to avoid NoSuchMethodException with config file
150- RUN printf 'registry:\n active: true\n jenkins:\n active: true\n content:\n examples: true\n application:\n "yes": true\n features:\n argocd:\n active: true\n env:\n - name: mykey\n value: myValue\n secrets:\n vault:\n mode: "dev"\n exampleApps:\n petclinic:\n baseDomain: "base"' > config.yaml && \
151- java -agentlib:native-image-agent=config-merge-dir=conf/ -jar gitops-playground.jar \
152- --trace --config-file=config.yaml || true
153- # Run again with different params in order to avoid NoSuchMethodException with output-config file
154- RUN java -agentlib:native-image-agent=config-merge-dir=conf/ -jar gitops-playground.jar \
155- --yes --output-config-file || true
156- RUN native-image -Dgroovy.grape.enable=false \
157- -H:+ReportExceptionStackTraces \
158- -H:ConfigurationFileDirectories=conf/ \
159- -H:IncludeResourceBundles=org.eclipse.jgit.internal.JGitText \
160- -H:DynamicProxyConfigurationFiles=conf/proxy-config.json \
161- -H:DynamicProxyConfigurationResources=proxy-config.json \
162- -H:ReflectionConfigurationFiles=conf/reflect-config.json \
163- -H:ReflectionConfigurationResources=reflect-config.json \
164- --features=com.cloudogu.gitops.graal.groovy.GroovyApplicationRegistrationFeature,com.cloudogu.gitops.graal.groovy.GroovyDgmClassesRegistrationFeature,com.cloudogu.gitops.graal.jgit.JGitReflectionFeature,com.cloudogu.gitops.graal.okhttp.OkHttpReflectionFeature \
165- --static \
166- --allow-incomplete-classpath \
167- --report-unsupported-elements-at-runtime \
168- --diagnostics-mode \
169- --initialize-at-run-time=org.codehaus.groovy.control.XStreamUtils,groovy.grape.GrapeIvy,org.codehaus.groovy.vmplugin.v8.Java8\$ LookupHolder,org.eclipse.jgit.lib.RepositoryCache,org.eclipse.jgit.internal.storage.file.WindowCache,org.eclipse.jgit.transport.HttpAuthMethod\$ Digest,org.eclipse.jgit.lib.GpgSigner,io.micronaut.context.env.exp.RandomPropertyExpressionResolver\$ LazyInit \
170- --initialize-at-build-time \
171- --no-fallback \
172- --libc=musl \
173- --install-exit-handlers \
174- -jar gitops-playground.jar \
175- apply-ng
176-
177-
178-
179- FROM alpine AS prod
180- # copy groovy cli binary from native-image stage
181- COPY --from=native-image /app/apply-ng app/apply-ng
182- ENTRYPOINT ["/app/apply-ng" ]
183-
184-
185130FROM eclipse-temurin:${JDK_VERSION}-jre-alpine AS dev
186131
187132# apply-ng.sh is part of the dev image and allows trying changing groovy code inside the image for debugging
@@ -204,7 +149,7 @@ ENTRYPOINT [ "java", \
204149 "/app/src/main/groovy/com/cloudogu/gitops/cli/GitopsPlaygroundCliMainScripted.groovy" ]
205150
206151# Pick final image according to build-arg
207- FROM ${ENV}
152+ FROM dev
208153ENV HOME=/home \
209154 HELM_CACHE_HOME=/home/.cache/helm \
210155 HELM_CONFIG_HOME=/home/.config/helm \
@@ -248,4 +193,4 @@ LABEL org.opencontainers.image.title="gitops-playground" \
248193 org.opencontainers.image.version="${VCS_REF}" \
249194 org.opencontainers.image.created="${BUILD_DATE}" \
250195 org.opencontainers.image.ref.name="${VCS_REF}" \
251- org.opencontainers.image.revision="${VCS_REF}"
196+ org.opencontainers.image.revision="${VCS_REF}"
0 commit comments