warp icon indicating copy to clipboard operation
warp copied to clipboard

Is there a docker image available?

Open nomailme opened this issue 6 years ago • 7 comments

Hi. Thank you for a great tool I'm currently using docker to build my project and thought of using warp-packer as a packing stage. Searched through the DockerHub but was unable to find one. Is there a docker image available? If not, maybe it would be a good idea for a feature request? Thank you.

nomailme avatar Jun 05 '19 07:06 nomailme

I think that would be a lot easier to just download the warp-packer binary you need at build/packaging stage:

  • Stage 1: build your app whitin your language/framework sdk docker image
  • Stage 2: download warp-packer binary and warp your app
  • Stage 3: create the deployment-ready image from language/framework runtime image

Maybe would be a nice idea to provide a few template Dockerfiles for supported languages/frameworks.

manchoz avatar Jun 05 '19 08:06 manchoz

It is the exact approach I am currently using. I can post an example Dockerfile in the next few days if you would like one

nomailme avatar Jun 05 '19 12:06 nomailme

I've created an example project that builds .NET Core console application in docker and then packs it using warp-packer. You can use it as a reference for your example or link my project. https://github.com/nomailme/warp-playground

nomailme avatar Jun 06 '19 07:06 nomailme

I would add a fine build stage to generate a minimal image. Just append the following lines to your Dockerfile:

FROM mcr.microsoft.com/dotnet/core/runtime-deps AS runtime
WORKDIR /app

COPY --from=build-env /app/out/warp-example /app/

ENTRYPOINT ["/app/warp-example"]

manchoz avatar Jun 06 '19 13:06 manchoz

Well the point of the Dockerfile is to build application. It doesn't really need any entrypoints. If you will look into the build.sh file it builds image. During the second command it runs container and pulls out compiled file. This way I get resulting single-file executable.

So docker is used only to build project and pack it.

nomailme avatar Jun 06 '19 13:06 nomailme

Docker multi-stage builds have been introduced in Docker 17.05 precisely to deal with such a scenario.

manchoz avatar Jun 06 '19 13:06 manchoz

I am well aware of the multi-stage builds. But result of multi-stage build is a container. In my case it's the single-file executable I am after.

If the result of the build is a container image then there is no point of using warp-packer as I don't really care how many files there are in the container and their placement.

nomailme avatar Jun 06 '19 14:06 nomailme