-
Notifications
You must be signed in to change notification settings - Fork 11
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
Use multi-stage builds to unzip and copy jars #118
Open
bradbown
wants to merge
17
commits into
main
Choose a base branch
from
docker-coordinator-image-size-reduction
base: main
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.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f23163d
Use multi-stage builds to unzip and copy jars
bradbown 509c849
Change base docker iamge
bradbown 8735711
Fix mkdir command
bradbown ae511ac
Revert mkdir concat
bradbown fa79edf
Remove apt-get calls
bradbown 73ff35a
Revert local COPY change
bradbown 5b53c07
Use apk to install packages
bradbown 752dbd1
Revert to debian based image
bradbown 79d97a7
Fix copy location
bradbown c236977
Merge mkdir commands
bradbown ad5d7dc
Amended directories
bradbown 0aa70ff
Merge branch 'refs/heads/main' into docker-coordinator-image-size-red…
bradbown bbca07c
Remove libs based on platform
bradbown 5ddcc16
Use uname -m to get current architecture
bradbown da905b6
Switch if statement to case statement to uname call
bradbown 7093f1d
Fix zip copy
bradbown a63e658
Add WORKDIR to improve readability, move removal of darwin dir out of…
bradbown 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,47 @@ | ||
FROM openjdk:22-ea-17-slim-bookworm | ||
FROM openjdk:21-jdk-slim AS builder | ||
|
||
RUN apt-get update \ | ||
&& apt-get install curl -y \ | ||
&& apt-get install unzip -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN apt-get update && apt-get install unzip -y | ||
|
||
RUN mkdir -p /src /libs | ||
|
||
COPY --from=zip ./coordinator.zip /src | ||
|
||
RUN unzip /src/coordinator.zip -d /libs | ||
|
||
WORKDIR /libs/coordinator/lib/ | ||
|
||
RUN mkdir -p unpacked-blob-compressor unpacked-blob-shnarf-calculator | ||
RUN cd unpacked-blob-compressor/ && jar -xf ../blob-compressor-0.0.4.jar | ||
RUN cd unpacked-blob-shnarf-calculator/ && jar -xf ../blob-shnarf-calculator-0.0.4.jar | ||
|
||
RUN rm -rf unpacked-blob-compressor/darwin-** && \ | ||
rm -rf unpacked-blob-shnarf-calculator/darwin-** && \ | ||
case $(uname -m) in \ | ||
x86_64) \ | ||
rm -rf unpacked-blob-compressor/linux-aarch64/; \ | ||
rm -rf unpacked-blob-shnarf-calculator/linux-aarch64/; \ | ||
;; \ | ||
aarch64) \ | ||
rm -rf unpacked-blob-compressor/linux-x86-64/; \ | ||
rm -rf unpacked-blob-shnarf-calculator/linux-x86-64/; \ | ||
;; \ | ||
esac | ||
|
||
RUN jar -cf blob-compressor-0.0.4.jar -C unpacked-blob-compressor . && \ | ||
jar -cf blob-shnarf-calculator-0.0.4.jar -C unpacked-blob-shnarf-calculator . && \ | ||
rm -rf unpacked-blob-compressor && rm -rf unpacked-blob-shnarf-calculator | ||
|
||
FROM openjdk:21-jdk-slim | ||
|
||
WORKDIR /opt/consensys/linea/coordinator | ||
|
||
# copy application | ||
COPY --from=zip ./coordinator.zip /opt/consensys/linea/coordinator/libs/ | ||
RUN unzip libs/coordinator.zip -d libs/ && mv libs/coordinator/lib/** libs/ && rm -R libs/coordinator/ | ||
RUN apt-get update \ | ||
&& apt-get install curl -y \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& mkdir -p /libs/ /logs /tmp/prover/request /tmp/prover/response | ||
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. I dun think we even need these |
||
|
||
RUN mkdir -p /opt/consensys/linea/coordinator/logs | ||
RUN mkdir -p /opt/consensys/linea/coordinator/tmp/prover/request | ||
RUN mkdir -p /opt/consensys/linea/coordinator/tmp/prover/response | ||
COPY --from=builder /libs/coordinator/lib/** libs/ | ||
|
||
# Build-time metadata as defined at http://label-schema.org | ||
ARG BUILD_DATE | ||
|
@@ -29,5 +56,3 @@ LABEL org.label-schema.build-date=$BUILD_DATE \ | |
org.label-schema.vendor="ConsenSys" \ | ||
org.label-schema.version=$VERSION \ | ||
org.label-schema.schema-version="1.0" | ||
|
||
WORKDIR /opt/consensys/linea/coordinator/ |
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.
I'd suggest to add the below line here to avoid the repeated prefix in paths: