Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Pass build arguments into docker build step when using a yaml file #511

Closed
ossentoo opened this issue May 29, 2020 · 4 comments
Closed

Pass build arguments into docker build step when using a yaml file #511

ossentoo opened this issue May 29, 2020 · 4 comments
Milestone

Comments

@ossentoo
Copy link
Contributor

ossentoo commented May 29, 2020

Hi,

My application pulls private nuget packages from an Azure DevOps feed in the docker image build. We normally accomplish this in our Azure DevOps pipeline by passing a build argument to docker build.

I've setup a yaml file to run locally at the moment. This is failing during the dotnet restore step in the Dockerfile as expected, because it needs the credential to the private nuget feed.

Is there a way of passing this in? I'm running locally so, I don't mine passing the PAT in somehow.

I've tried this:

name: application
services:

  • name: web
    dockerFile: ../application-web/src/Dockerfile --build-arg PAT=***

I get this output when running tye run with a tye.yaml file in the same directory:

[06:44:57 INF] Building docker image web from docker file
[06:44:57 INF] [web]:unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /Users/blah/application-web/src/Dockerfile --build-arg PAT=***: no such file or directory

@jkotalik
Copy link
Contributor

Yeah, today passing in dockerFile assumes that it is only a path to the docker file, and doesn't include args.

@davidfowl for docker run, do we allow passing in args as well? Is that through the args section in the yaml?

@ossentoo
Copy link
Contributor Author

Ok.

Is there any work around for now? Can I call docker build for example for now?

@davidfowl
Copy link
Member

I thought we had support for arguments being passed to build but there isn't we'll need to add it.

@ossentoo
Copy link
Contributor Author

ossentoo commented May 31, 2020

I'm going to work on some code for this issue. Will raise a PR and appreciate any feedback.

ossentoo pushed a commit to ossentoo/tye that referenced this issue May 31, 2020
ossentoo pushed a commit to ossentoo/tye that referenced this issue May 31, 2020
@jkotalik jkotalik added this to the 0.3 milestone Jun 8, 2020
jkotalik pushed a commit to ossentoo/tye that referenced this issue Jun 18, 2020
jkotalik added a commit that referenced this issue Jun 18, 2020
* Added support for docker build arguments

* fixed whitespace issue? #511

* Additional tests

* Update src/Microsoft.Tye.Core/ApplicationFactory.cs

Co-authored-by: Justin Kotalik <jukotali@microsoft.com>

* Update src/Microsoft.Tye.Core/Serialization/ConfigServiceParser.cs

Co-authored-by: Justin Kotalik <jukotali@microsoft.com>

* Update test/E2ETest/TyeBuildTests.Dockerfile.cs

Co-authored-by: Justin Kotalik <jukotali@microsoft.com>

* Moved below DockerFile to keep ordering consistent.

* refactored HandleServiceDockerArgsNameMapping

* Use a stringbuilder for concatenation

* Removed appsettings development file

* Removed launchSettings file

* duplicate parameters test

* Multiple build args test

* small nits

Co-authored-by: Oscar Yahoo <ossent@yahoo.co.uk>
Co-authored-by: Justin Kotalik <jukotali@microsoft.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants