farmer icon indicating copy to clipboard operation
farmer copied to clipboard

Chicken and egg with docker

Open forki opened this issue 3 years ago • 3 comments

Farmer has support for azure container registries and also for container services. Right now our deployment is a multi step process.

  1. create a container registry in farmer and store access key somewhere
  2. docker build
  3. docker push with access key from step 0)
  4. create webapp node in farmer and point it to the container

In a perfect world I'd like to see this:

  1. docker build
  2. add azure registry node in farmer
  3. point farmer webapp node to the local image
  4. farmer pushes the container automagically since it knows the azure container registry

forki avatar Dec 07 '21 10:12 forki

We could probably use a PostDeploymentTask for this - we use a similar approach for app service where Farmer zips and uploads the web app directly into the app service that it's just deployed.

Is the docker push difficult to set up?

isaacabraham avatar Dec 10 '21 22:12 isaacabraham

@forki I've been doing something recently that's very similar to what you're doing. I'm currently doing this as follows:

  1. Create ACR.
  2. Return the user, pass and server url as outputs.
  3. Use docker to build, tag and push the image to ACR.
  4. Create a web app and configure it to look at the ACR instance using the docker_ keywords on the web app.

I'm not sure I'm a fan of the idea of pointing a local docker image to a web app and having it implicitly upload that container's image to ACR - that feels like one step too many to me. However, I'd be interested in other people's thoughts @ninjarobot.

isaacabraham avatar Jan 23 '22 00:01 isaacabraham

Instead of it building locally (or in CI) and then pushing the image, would it simplify your process to build the image on the registry itself? The build system will produce artifacts that are ready to copy to an image, and you can have your build system login to the ACR and then do a docker build directly on the ACR with az acr build.

ninjarobot avatar Apr 18 '22 14:04 ninjarobot

@forki Hi, did any of the solutions presented help with resolving this issue?

martinbryant avatar Aug 18 '23 08:08 martinbryant

we're still working with multi step deployment. but it's OK since we doig green/blue deployment anyways.

thanks for the help

forki avatar Aug 18 '23 08:08 forki