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

Add building option to build images base on distroless image #2115

Open
zyy17 opened this issue Aug 8, 2023 · 2 comments
Open

Add building option to build images base on distroless image #2115

zyy17 opened this issue Aug 8, 2023 · 2 comments
Labels
C-enhancement Category Enhancements good first issue Good for newcomers

Comments

@zyy17
Copy link
Collaborator

zyy17 commented Aug 8, 2023

What type of enhancement is this?

User experience

What does the enhancement do?

To further reduce the size of the image, we can use distroless(as the building option) as the base image.

Implementation challenges

No response

@zyy17 zyy17 added C-enhancement Category Enhancements good first issue Good for newcomers labels Aug 8, 2023
@zyy17 zyy17 changed the title Add distroless images Add building option to build images base on distroless image Aug 8, 2023
@tisonkun
Copy link
Collaborator

To be clear, this issue is to add the option for self-building Docker image. It won't be integrated into our release workflow (or at least yet).

The related file is:

  • docker/buildx - You can find centos/Dockerfile and ubuntu/Dockerfile there for reference. It's a one-stop build script for producing the image. We may add a distroless/Dockefile there.
  • docker/ci - you can also find centos/Dockerfile and ubuntu/Dockerfile. It packages a pre-built binary to a find image environment. We may add a distoless/Dockerfile there also to copy a pre-built binary and set up the environment.
  • Makefile - it contains docker-image-buildx and docker-image target. We may make BASE_IMAGE=distoless work here.

@zyy17
Copy link
Collaborator Author

zyy17 commented Nov 20, 2024

In some scenarios, the current image size(500MiB+ in compression) may be too big for the following reasons:

  • Python dependencies: It's not in active development and usage;

  • Base image: Although the Ubuntu image is easy to use and debug conveniently, it's not a safe base for security reasons;

One of the references Dockerfile can be(only work for x86_64):

# glibc
FROM gcr.io/distroless/cc-debian12:latest

COPY --from=ubuntu:22.04 /lib/x86_64-linux-gnu/libz.so.1.2.11 /lib/x86_64-linux-gnu/libz.so.1
COPY --from=busybox:1.31.1 /bin/busybox /bin/busybox

ADD greptime /bin

ENTRYPOINT ["greptime"]

The image size will be 100MiB in compression(1/5 of the size of the original image).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category Enhancements good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants