Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    [BM] How to build a docker container from gitlab using env file

    Scheduled Pinned Locked Moved Support
    dockerbuildmaster
    4 Posts 2 Posters 9 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      philippe.camelio_3885
      last edited by philippe.camelio_3885

      Hi guys,

      I am looking for some help. I am trying to build a container using BM, and can't figure out how to pass env file to docker build

      I am using a simple git repo which contains:

      • Dockerfile
      • myapp.env

      How to config Docker::Build-Image to use myapp.env

      I am using a very simple script :

      Git::Checkout-Code();
      Docker::Build-Image();
      

      Any advice or sample is welcome

      1 Reply Last reply Reply Quote 0
      • rhessingerR Offline
        rhessinger inedo-engineer
        last edited by

        Hi @philippe-camelio_3885,

        Based on that script, as long as your Dockerfile is at the root of the $WorkingDirectory (From defaults to $WorkingDirectory) and the myapp.env is specified within the Dockerfile, that script should work. Can you please tell me what you are seeing while running Build-Image?

        Thanks,
        Rich

        Products Engineer, Inedo

        P 1 Reply Last reply Reply Quote 0
        • P Offline
          philippe.camelio_3885 @rhessinger
          last edited by

          Hi @rhessinger
          I will dig in this direction.
          I let you know.

          Thanks for the tip.
          Best regards

          1 Reply Last reply Reply Quote 0
          • P Offline
            philippe.camelio_3885
            last edited by

            I finally found how to handle properly (I guess) the variable
            The Dockerfile looks like:

            ARG SOME_VAR=default_var
            
            FROM some_image:some_version
            
            WORKDIR /usr/src/app
            RUN ....
            
            

            and the Deploy script like :

            Git::Checkout-Code();
            Docker::Build-Image
            (
                DockerfileVariables: %(SOME_VAR:myvar),
                Tag: $ReleaseNumber-pre.$BuildNumber,
                RemoveAfterPush: true
            );
            

            bur I have signing problem to push container in proget. => I start a new thread

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post
            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation