-
Notifications
You must be signed in to change notification settings - Fork 182
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
Shrink container image with --no-cache option on apk #459
Conversation
Hey @OctopusET, thanks a lot for the contribution. We really want to reduce the size of the container image, so I tested it locally as well. I found that the original image from I was confused a bit so I checked out the size of the APK index under $ ls -lh /var/cache/apk/
total 2M
-rw-r--r-- 1 root root 422.1K Jun 26 11:02 APKINDEX.49104001.tar.gz
-rw-r--r-- 1 root root 1.4M Jun 26 11:02 APKINDEX.884188d8.tar.gz So, I have two questions here:
diff --git a/Dockerfile b/Dockerfile
index c247982..5e0f1c6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,7 @@ ARG TESSDATA_CHECKSUM=990fffb9b7a9b52dc9a2d053a9ef6852ca2b72bd8dfb22988b0b990a70
# Install dependencies
RUN apk --no-cache -U upgrade && \
- apk add \
+ apk --no-cache add \
ghostscript \
graphicsmagick \
libreoffice \
@@ -26,7 +26,6 @@ RUN apk --no-cache -U upgrade && \
RUN mkdir tessdata && cd tessdata \
&& TESSDATA_VERSION=$(wget -O- -nv https://api.github.com/repos/tesseract-ocr/tessdata/releases/latest \
| sed -n 's/^.*"tag_name": "\([0-9.]\+\)".*$/\1/p') \
- && apk --purge del jq \
&& wget https://github.com/tesseract-ocr/tessdata/archive/$TESSDATA_VERSION/tessdata-$TESSDATA_VERSION.tar.gz \
&& echo "$TESSDATA_CHECKSUM tessdata-$TESSDATA_VERSION.tar.gz" | sha256sum -c \
&& tar -xzvf tessdata-$TESSDATA_VERSION.tar.gz -C . \ |
Hello, thank you for the comment.
It's not related to this PR. This PR was made during I'm working on the adding a hwp supports. |
That's exciting!
Sure, go ahead. |
I just posted my draft PR #460! Just curious, what was that line for?
|
Great, thanks! I'll comment there soon.
Oh, good question. In order to get the Tesseract data version, I initially installed This didn't cause any problem, up to the point where we removed the APK index. By doing so, this line would fail. So, I removed it. |
This option shrinks container image more than half.
result: 1.95 GB -> 882 MB