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

Support ability to add docker command(s) after base image #1488

Closed
pertsodian opened this issue Dec 30, 2021 · 2 comments
Closed

Support ability to add docker command(s) after base image #1488

pertsodian opened this issue Dec 30, 2021 · 2 comments

Comments

@pertsodian
Copy link

Expected behaviour

Allow via settings so that we can have the following in generated Dockerfile

FROM <base_image> as mainstage
RUN microdnf update -y && microdnf clean all
<the rest>

As I understand, we need this so that we can stay up to date if there are any security updates

Actual behaviour

dockerCommands is a Seq so we can only append or prepend, or write from scratch

I would not mind writing from scratch since our use case is very simple.
So I could just take the generated Dockerfile, add my favorite extra commands at my favorite spots and override the dockerCommands entirely.

However, with the multiple-layers changes, we have these /1 /2 etc. Those could look a little too raw (?), plus I'm not sure if they are subjected to be changed in subsequent versions.

Information

  • What sbt-native-packager are you using: 1.9.7
  • What sbt version: 1.6.1
  • What is your build system (e.g. Ubuntu, MacOS, Windows, Debian ): MacOS
  • What package are you building (e.g. docker, rpm, ...): docker
  • What version has your build tool (find out with e.g. rpm --version): 20.10.10
@pertsodian
Copy link
Author

I guess the other side of the argument is to create our own base image separately, instead of calling microdnf update in every build. This sounds like better idea..

@pertsodian
Copy link
Author

In case someone else runs into this, but cannot afford to manage own base image, I think this could be a good alternative:

  dockerBaseImage := "basestage",
  dockerCommands := Seq(
    Cmd("FROM", ActualBaseDockerImage, "as basestage"),
    Cmd("RUN", "microdnf update -y && microdnf clean all"),
    Cmd("")
  ) ++ dockerCommands.value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant