slim icon indicating copy to clipboard operation
slim copied to clipboard

Add entrypoint script to dslim build

Open BEIIKS opened this issue 3 years ago • 2 comments

In my image I used an entrypoint that insert env variables to vue project, in Dockerfile:

COPY ./client/entrypoint.sh /usr/share/nginx/entrypoint.sh
RUN chmod +x /usr/share/nginx/entrypoint.sh
ENTRYPOINT ["sh", "/usr/share/nginx/entrypoint.sh"]

and the docker command is: docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/docker-slim build --http-probe=false --include-path=/usr/src/app --include-path=/usr/local/lib/node_modules/npm/node_modules my_image_name

I'm not sure where I supose to add flag for entrypoint and which one

Thanks for any help :D

BEIIKS avatar Feb 10 '22 09:02 BEIIKS

@BEIIKS not quite clear what you are trying to accomplish with the entrypoint flag. docker-slim does have a way to override the entrypoint for your container, but you shouldn't need to use it unless you don't want docker-slim to use what's declared as the entrypoint in your Dockerfile. If you want ENTRYPOINT ["sh", "/usr/share/nginx/entrypoint.sh"] to execute then you don't need to do anything extra.

By the way, I'm curious why you are disabling http probes if you have a Vue app... Do you have an EXPOSE instruction in your Dockerfile?

kcq avatar Feb 13 '22 05:02 kcq

@BEIIKS not quite clear what you are trying to accomplish with the entrypoint flag. docker-slim does have a way to override the entrypoint for your container, but you shouldn't need to use it unless you don't want docker-slim to use what's declared as the entrypoint in your Dockerfile. If you want ENTRYPOINT ["sh", "/usr/share/nginx/entrypoint.sh"] to execute then you don't need to do anything extra.

By the way, I'm curious why you are disabling http probes if you have a Vue app... Do you have an EXPOSE instruction in your Dockerfile?

Well then, I guess it's because something else. I'll let you see the difference between the full size image and the shave one. Full size - image

After dslim - image

And yes, for extra information we have EXPOSE 80 in our docket file, not that it matters at all.

BEIIKS avatar Feb 13 '22 08:02 BEIIKS