-
Notifications
You must be signed in to change notification settings - Fork 3k
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
docker: optimize layers #10859
Draft
shirshanka
wants to merge
3
commits into
datahub-project:master
Choose a base branch
from
shirshanka:docker_layer_optimize
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
docker: optimize layers #10859
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,12 @@ ARG ALPINE_REPO_URL | |
ENV DOCKERIZE_VERSION v0.6.1 | ||
WORKDIR /go/src/github.com/jwilder | ||
|
||
# Optionally set corporate mirror for apk | ||
RUN if [ "${ALPINE_REPO_URL}" != "http://dl-cdn.alpinelinux.org/alpine" ] ; then sed -i "s#http.*://dl-cdn.alpinelinux.org/alpine#${ALPINE_REPO_URL}#g" /etc/apk/repositories ; fi | ||
|
||
RUN apk --no-cache --update add openssl git tar curl | ||
|
||
WORKDIR /go/src/github.com/jwilder/dockerize | ||
|
||
RUN go install github.com/jwilder/dockerize@$DOCKERIZE_VERSION | ||
# Optionally set corporate mirror for apk and install dependencies | ||
RUN if [ "${ALPINE_REPO_URL}" != "http://dl-cdn.alpinelinux.org/alpine" ] ; then \ | ||
sed -i "s#http.*://dl-cdn.alpinelinux.org/alpine#${ALPINE_REPO_URL}#g" /etc/apk/repositories ; \ | ||
fi \ | ||
&& apk --no-cache --update add openssl git tar curl \ | ||
&& go install github.com/jwilder/dockerize@$DOCKERIZE_VERSION | ||
|
||
FROM alpine:3.20 AS base | ||
|
||
|
@@ -35,10 +33,10 @@ ARG MAVEN_CENTRAL_REPO_URL | |
|
||
# Upgrade Alpine and base packages | ||
# Optionally set corporate mirror for apk | ||
RUN if [ "${ALPINE_REPO_URL}" != "http://dl-cdn.alpinelinux.org/alpine" ] ; then sed -i "s#http.*://dl-cdn.alpinelinux.org/alpine#${ALPINE_REPO_URL}#g" /etc/apk/repositories ; fi | ||
|
||
# PFP-260: Upgrade Sqlite to >=3.28.0-r0 to fix https://security.snyk.io/vuln/SNYK-ALPINE39-SQLITE-449762 | ||
RUN apk --no-cache --update-cache --available upgrade \ | ||
RUN if [ "${ALPINE_REPO_URL}" != "http://dl-cdn.alpinelinux.org/alpine" ] ; then \ | ||
sed -i "s#http.*://dl-cdn.alpinelinux.org/alpine#${ALPINE_REPO_URL}#g" /etc/apk/repositories ; \ | ||
fi \ | ||
&& apk --no-cache --update-cache --available upgrade \ | ||
&& apk --no-cache add curl bash coreutils gcompat sqlite libc6-compat snappy \ | ||
&& apk --no-cache add openjdk17-jre-headless --repository=${ALPINE_REPO_URL}/edge/community \ | ||
&& apk --no-cache add jattach --repository ${ALPINE_REPO_URL}/edge/community/ \ | ||
|
@@ -48,18 +46,24 @@ RUN apk --no-cache --update-cache --available upgrade \ | |
&& wget --no-verbose ${GITHUB_REPO_URL}/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.24.0/opentelemetry-javaagent.jar \ | ||
&& wget --no-verbose ${MAVEN_CENTRAL_REPO_URL}/io/prometheus/jmx/jmx_prometheus_javaagent/${JMX_VERSION}/jmx_prometheus_javaagent-${JMX_VERSION}.jar -O jmx_prometheus_javaagent.jar \ | ||
&& cp /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts /tmp/kafka.client.truststore.jks | ||
|
||
COPY --from=binary /go/bin/dockerize /usr/local/bin | ||
|
||
ENV LD_LIBRARY_PATH="/lib:/lib64" | ||
|
||
FROM base as prod-install | ||
|
||
COPY war.war /datahub/datahub-gms/bin/war.war | ||
COPY metadata-models/src/main/resources/entity-registry.yml /datahub/datahub-gms/resources/entity-registry.yml | ||
COPY docker/datahub-gms/start.sh /datahub/datahub-gms/scripts/start.sh | ||
COPY docker/datahub-gms/jetty.xml /datahub/datahub-gms/scripts/jetty.xml | ||
COPY docker/datahub-gms/jetty-jmx.xml /datahub/datahub-gms/scripts/jetty-jmx.xml | ||
COPY docker/monitoring/client-prometheus-config.yaml /datahub/datahub-gms/scripts/prometheus-config.yaml | ||
RUN chmod +x /datahub/datahub-gms/scripts/start.sh | ||
|
||
RUN chmod +x /datahub/datahub-gms/scripts/start.sh \ | ||
&& addgroup -S datahub && adduser -S datahub -G datahub \ | ||
&& mkdir -p /etc/datahub \ | ||
&& chown -R datahub:datahub /datahub/datahub-gms /etc/datahub | ||
|
||
FROM base as dev-install | ||
# Dummy stage for development. Assumes code is built on your machine and mounted to this image. | ||
|
@@ -69,8 +73,6 @@ FROM ${APP_ENV}-install as final | |
|
||
RUN mkdir -p /etc/datahub/plugins/auth/resources | ||
|
||
RUN addgroup -S datahub && adduser -S datahub -G datahub | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer being applied to dev-install, this is probably a regression. |
||
RUN chown -R datahub:datahub /etc/datahub | ||
USER datahub | ||
|
||
ENV JMX_OPTS="" | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be an out of order issue here. If the chown/chmod was expected to apply to the config file, it is no longer. I'd move the COPY above