lidstah, (edited )
@lidstah@lemmy.sdf.org avatar

A bit late but you might want to have a look at docker multi-stage build documentation which does exactly what you did (start from a base image then copying stuff from it to your own image), something like that:


<span style="color:#323232;">FROM someimage:sometag AS build
</span><span style="color:#323232;">[do stuff]
</span><span style="color:#323232;">FROM minimalimage:someothertag
</span><span style="color:#323232;">COPY --from=build /some/file /some/other/file
</span><span style="color:#323232;">[and so on]
</span><span style="color:#323232;">USER somebody
</span><span style="color:#323232;">CMD ["/path/somecommand"]
</span>

Which will simplify building new images against newer “build” image newer tags easier.

btw, you were quite creative on this one! You also might want to have a look at the distroless image, the goal being to only have the bare minimum to run your application in the image: your executable and its runtime dependencies.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #