dgiagio / warp

Create self-contained single binary applications
MIT License
1.91k stars 92 forks source link

Is there a docker image available? #38

Open nomailme opened 5 years ago

nomailme commented 5 years ago

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.

manchoz commented 5 years ago

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

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

nomailme commented 5 years ago

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 commented 5 years ago

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

manchoz commented 5 years ago

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"]
nomailme commented 5 years ago

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.

manchoz commented 5 years ago

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

nomailme commented 5 years ago

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.