>> Hey, friends. Do you want to see how easy it is to build,
push and deploy containers to Azure Web App for containers?
Now, you can do it all with one command
with the Azure Container Registry.
Steve is here to show us how to make
the magic happen today on Azure Friday.
[MUSIC]
Hey folks, I'm Scott Hanselman,
and this is another episode of Azure Friday.
I'm here with Steve Lasker, and we're going to talk about
a fantastic thing that I had been using myself.
I did a couple of YouTube's on it,
ACR Build makes life better.
>> Yes. We've been doing some work.
We're basically trying to
streamline the ability to build locally before you commit.
Then we'll support you when you do your commit code,
and then afterwards when you're stopping your commit to your code.
How do you patch containers?
So, think of it as a whole life cycle management.
>> Yes.
>> I was watching the video you did a couple of weeks ago,
when you're using builds and Go on App Service.
>> I was frankly using more gestures than I think I needed to,
and it was probably a little bit of my own lack of education.
But also not understanding
some of the features that were available.
So, I figured we have you explain to me
a really tight inner loop on making my life better.
>> Definitely. So, that's why I wanted to show up.
So, here we've got a project.
I just did a really simple single-page node app,
or single-page, single file node app to show this out.
It's simply just going to mess with this
little "hello world" here in the center.
So, with that file locally,
normally I would have to do a docker build,
right? Then you tag it.
>> Right.
>> Hello world.
>> So, I always forget.
>> It's not going to go anywhere unless you tag it.
You want some unique ID which we'll talk about more as well.
Then you would say dot.
Then you would have to say "docker push".
>> Docker push? Actually I
misspell docker and I have make it docket.
>> Yes.
>> I've actually made batch files and
aliases to save myself from that.
>> Yes. There's lots of shortcuts I
actually was watching when you didn't do that.
>> Yes.
>> So, instead of having to do both of those,
one of the things that we wanted to do is just
build this into our pipeline.
So, now with the "AZ CR CLI,
AZ ACR build-t, hello world."
For the unique ID, we can just grab the build ID from a acr build.
Then I would say dot for the context and set it up.
Now, because we're going to deploy to App Service,
I'm actually going to give it two tags,
and we'll talk a little bit about that later.
"Hello world."
>> So, one is generated,
and one is explicit.
>> Yes. So, when we think about the experiences with App Service,
and we have this other video will do on tagging best practices,
we really want a unique tag to manage our deployments.
We've had so many calls in ACR,
people are struggling with trying to debug some inconsistency.
>> Yes.
>> It turned out that they had
inconsistent values for other images that was the single tag.
>> Right.
>> So, give me a consistent.
>> Oh yes. If you tag something,
or you market, whether it be in GitHub,
we've all had experiences where one tag we thought was something,
but we went to the explicit commit hash,
and it was the other thing.
So, you're kind of doubling up on best practices here.
You're being explicit in two different ways.
>> Well, we actually want the release want to go away to be fair,
but the App Service deployments right now only
support that you can't update the tag as part of the web hook.
So, that's some work that we're working on improving.
>> So, this is going to get even simpler.
>> It's going to get even simpler.
>> I like that. Simple is good.
>> We did notice that
PowerShell doesn't like those little curly brackets.
So, we'll just stick in things like quotes.
>> So, the one is generated,
and this is interesting,
the build is not happening locally here, which is important.
>> No. In fact I don't even need Docker locally.
I might have problems like configuration,
we have one of our interns are going to come with the [inaudible].
>> You might have a machine that doesn't have Hyper-V.
>> Then Windows Home edition doesn't have.
>> I didn't even think about that. I do
have laptops that have Windows Home,
and now I can go and build my docker stuff and deploy it.
>> Yes. So, what's nice
also is you will get complete consistency.
So, here I'm doing my inner loop, and I'm doing builds.
When I do my Git Commits,
I'll use the same exact infrastructure.
Then when I do release for
us in framework patching, again will be the same.
So, here, and the thing that's nice also
is we're still seeing the stream logs. Right.
>> It feels local.
>> It feels like your local experience,
and we have some pretty cool stuff that'll make
this run even faster over time as well.
So, things one day just will start running just as fast as local.
So, while that's happening,
one of the things we'll be able to see is it's actually,
in fact, I'm just going to disconnect here.
>> So, it's still happening though.
>> "az acr build-task logs".
>> Okay.
>> If I don't specify one,
it'll just give me the last one that's been executing.
>> Okay.
>> So, we'll see it just stream out,
and there you go,
it's going to show me the whole log,
and it's just finishing up now.
>> Oh.
>> If we look, we'll drill into this more.
You can see some images we've built.
>> Alright.
>> The dependencies, and so we'll talk
more about this here in a moment.
So, now we've got that image.
In fact, we have the extension here
for VS Code that supports ACR Build as well.
>> Okay.
>> So, well, this is under development,
so I have to hit "Refresh" for the whole thing.
>> Sure.
>> But if I go to "demo42," we see "hello
world," and then you can see
the release and the other one that I just built,
and I could even see the logs here as well.
Oh, I see. So, the curly bracket,
curly bracket build.id, that
build ID that was generated was unique in that case it.
>> Exactly.
>> AAGU.
>> What am I? So, okay, something's going on wrong.
>> Which registry you're going to use the demo to do that?
>> Then hit "demo42".
I don't know why it's asking me that, didn't do so.
>> That was an active development.
>> Yes. So, we still have some work. Then you could
see there's the tags,
and then I can open the logs from here as well.
So, you'll be able to get all of
that information locally. We even got it in color.
So, anyway, we've got our build,
we can browse the other images that are right here.
I could even deploy to App Service,
where if I choose a particular tag,
but I actually find it easier to do in the portal in this case.
>> Okay.
>> So, we'll do that, and I think it
demos a little better as well.
So, I come here to our "demo42" registry.
We'll look at our repositories,
and we'll see a "helloworld" one here,
as well as everything else.
>> Right.
>> So, there's "demo42 helloworld".
>> I am going to use the release tag here.
So, I'm going to deploy a web app,
and we'll call it Steve Less.
>> Is that always a new deploy?
>> When you deploy the web app in this case,
it actually is configuring a new web app, yes.
>> Okay.
>> But in fact, in this case,
what I'm also going to do is deploy to an existing plan.
>> Plan, okay.
>> So, it goes faster,
and obviously I don't
want it to create each one of those each time,
because that's the thing you are paying for.
>> Exactly.
>> Down here, it was saying that
we're actually going to set up a web hook for you.
So, what we are doing is you built your,
regardless of how the image got in the registry,
and actually it doesn't really matter,
you can deploy to App Service,
and by choosing that gesture,
we will set up the web app,
we'll set up a web hook,
so that anytime an image is pushed,
it'll automatically do a deploy.
Like I said, some of the things we're working
on is making sure that we read
the payload in the web hook for the new tag.
This we can always deploy unique tags.
So, let that finish setting up here.
The other part that we're doing is we want to be able to
say we can easily build those images.
By stitching this pipeline together,
you'll see that we'll be able
to use the same command we had locally,
and have it automatically deployed to App Service.
>> Exactly, and then I just have one command, or no commands.
>> Well, yes. It depends on what you're trying to do, right?
>> Yes.
>> So, we'll click this.
It's going to finish doing the polls.
But I'll come back over here while that's loading,
and if we look,
we'll see the web hook is set up for us.
We'll see it hasn't fired yet,
because we have other, sorry it's fired.
>> There it goes.
>> So, those are the web hooks,
and if we go to configure,
we can see that for now,
it's configured with just the release tag.
>> Okay.
>> Because that's all app servers
can do as a signal tag right now,
but you've got your URL and all of that.
>> Okay. That's why we needed that second tag was
to give it something to key off when a new one got stitched.
>> Exactly.
>> As opposed to the idea of a latest most unique tag.
>> Yes. Latest is always a weird one,
so I tend to use the word newest for the newest tag.
>> Indeed.
>> Well, in this case I said release,
but we'll save that for another conversation.
>> So, there it is.
>> So, here's our app, its deployed.
But now, we want to come over here.
We're going to make a change,
maybe we're going to say Scott,
because I'm not sure how to spell your name,
so I'm just going to test this locally.
>> Okay.
>> So, I've saved it, no commits.
Well, I can still come over here and just say build again.
>> Oh, without doing a commit and really littering your [inaudible].
>> Nobody has to know that I can't spell your name.
It's just this is totally in our loop.
I just happen to be doing my inner loop in the cloud,
so it'll again rebuild that.
>> Then of course because you're being smart about your layering,
and how you created your Docker file,
this small change doesn't necessarily
because of Docker layering need to cause the whole world to.
>> Exactly.
>> To build again.
>> So, well, that's
some of the work that we're going to be adding in
for the interim build caches.
So, that's not there yet,.
>> [inaudible] there is Docker layering caching,
but there isn't incremental build caching yet.
>> Not yet.
>> But that means that everything is just
going to get faster like you said.
>> Exactly.
>> You're at the same commands you are running,
just all of a sudden we're going to start getting faster.
>> I love it.
>> So, but to your deployment though,
the deployment sitting there that's a running service.
So, when the web hook fires,
it only has to get that last thin layer of changes.
>> This is nice, because I know that I
have a lot of messy commits,
and squash to hide them.
Ultimately I want to see it in close to production.
But maybe not necessary, I want to run tests,
but I'm not ready to commit just to run test.
>> Exactly. Okay, so that's just about done,
and actually I'll show you another command here that's running.
So, here I'm running this in Cloud Shell,
and I'm basically just watching the list of bills,
and it refreshes every second.
>> Oh, okay.
>> So, you can see that last one is a manual one,
because there's no taskname that it has completed.
There it is. As it comes over here.
>> "az acr build-task" list holds,
and waits, and refreshes every second.
>> Well, hold on, let's go back.
So, what I'm doing.
>> Oh, you're doing a watch in front of it.
>> So, you're going to see me switch back and forth
between PowerShell and Bash here,
because it's the best tool for the job.
>> Of course.
>> In this case, I can paste into
an absolute Bash Environment and watch this. So, you can see the-
>> What a clever idea? That's one more reason
for me to spend time in the Cloud Shell.
>> They got VS Code there now too,
so it's really cool.
Okay. So, Scott, [inaudible] I can't spell,
so, well, I shouldn't say can't spell,
there are some people that actually spell the name that way.
>> A whole country of them.
>> It's the Stephen with a "ph" as well.
So, I guess the whole country of it, yes exactly.
Okay, so we're going to now commit this,
but before I commit actually,
I actually want my builds to be based on Git commits.
So, what I'm going to do is
grab and snippet a code that I've got up here,
just because it's got a little bit more.
If we look at this,
and I am going to come over to Bash and paste it,
so what I'm doing here, there it goes.
So, now what I'm going to say is "acr build-task create".
So, I'm going to create one,
that's going to tag it helloworld the same way I did before.
In this case, let me put the release on here as well.
Oh! I see, I grabbed the wrong one.
I have, that's my other demo.
>> So, you need your two tags.
>> Yes, so let's go grab the spine.
>> So, you're going to see if can read this really
quick because you're going to go, we're moving fast.
>> I'm going to paste it in here for it's the right one.
>> Create a new task, then new build tasks,
you've got that first unique helloworld,
you've got that temporary hello released tag.
You've got the name of where it's going to go to.
>> That's the name of the build-task.
>> Right.
>> That's the resource name.
>> Then, you've got your context where the source code is going,
and then you've got your Git access token,
which is very clean and clever of you,
I have to give you credit for that,
and then you've got a subcall to AZ,
to go and pull that secret out of the Key Vault, that's clean.
>> I learned this after having recordings.
>> Because.
>> I was going to change my key, I recorded it that way.
>> I'm copy pasting my secrets in there, and I shouldn't be.
>> So, we'll create that,
and so now what we have is,
we've got the build-task that's
actually setup on forget commits and more.
So, we'll talk about that in a second.
So, now we'll just do Scott Spelled his way because you're unique,
and we'll "Push" it, "Push" that,
and when I come back over here,
if I watch my build list again, where was that?
There we go. Well, we'll see
is that what we just created is queued up,
you can see the Taskname,
and it's based on a Git Commit because
you could see we have this trigger column.
So, that thing will queue up,
it will start its spilts,
and we can actually come over here, AZ,
ACR build-task logs, and we can stream the latest one, what is it?
AHD, and it started to run,
so we'll be able to see those kind of spew out here.
But now, this is the mode, right?
If you happen to be committing to that code as well.
>> Right.
>> Every time you're committing that builds going to kick in,
App Services, listening for web hook notifications,
and ACR build will go send it off.
>> All right. So, there you go, it's just took off.
>> Yes, so we've got our build queuing up just like we saw before,
and that'll run and we'll see that complete,
but like I said,
it will just automatically trigger a deployment.
So, let's go back, we'll just watch that finish
up there for a moment because it's almost finished,
you can see the layer exists.
Okay, so our builds' complete and what we can do,
if we come back over here because our web hook was triggering it,
if I just refresh,
we could see that,
that has been updated for a Git commit.
So, that's stage two.
Stage one was Pre-commit,
I can do my builds, have it automatically give up.
>> No Git commit, but still got to see it
in production or in developing production.
>> Or maybe another slot in App Service.
>> With the slot indeed.
>> Then, I just try to my commits,
I'm using the same build server.
Now, the last one is what's interesting here is,
If we go back to my project,
and if we notice that the Docker file actually said,
not that one, this Docker file actually said from base images
node in my own repo because this is a corporate scenario,
I'm managing my own base images because I want to control
how my patches are applied to my apps in my company.
Well, if I come over here and I edit this one,
and you'll notice I can change the background color.
What's your favorite color?
>> Purple.
>> Purple [inaudible].
>> Visual Studio purple.
>> I haven't tried purple, so we're going to see how this looks.
This could be horribly wrong,
but it'll be make my points.
>> Yes, indeed.
>> So, now that was Git,
that has been committed,
and notice here, I've got
my base image node has just been triggered by my Git commit.
>> Right.
>> What we'll see here in a moment is once that's done,
the Hello World App is actually going to start
rebuilding because what we've done is,
we have linked up the dependencies,
so if you look here, there's
a runtime dependency to base images node and the demo 42,
and that specific tag,
so now we're monitoring that and that'll work within ACR,
it'll actually work on Docker Hub.
So, if you're taking a dependency
straight from node, that's fine too,
just a little harder for me to demo,
updating the public node image,
and that would trigger on as well.
>> So, how tight is our inner loop now
compared to what you saw me doing,
as I was bumbling my way through learning about building?
>> Well, I'm also happy to say that,
the bug you tripped on, we fixed also.
That was just a DNS caching bug.
>> Sure.
>> Because as we do demos,
we delete our registries every time, is a good bug to find.
>> I apologize, what had happened to
my friends which I was on YouTube,
and I was deleting and creating,
and deleting and creating things,
in quite a short inner loop there,
which isn't something you would typically do,
which you might do it in a demo.
>> Well, you might have some tests that
you're trying to test some infrastructure.
So, we're tearing the entire.
>> I was tearing the whole thing
down and putting it back up again,
but certainly that's fixed as well now, which is nice.
>> So, that was cool. So, here we've got our builds that are
running and if we notice now we can see our image update,
and we've actually have three,
two, the second one is actually another bug.
This is a preview feature that we're finishing
up because we tagged it twice,
we figured you really wanted to be notified twice.
>> Indeed.
>> So, minor bug will go back and fix that,
and when that finishes,
we'll actually see this thing deployed here in a moment.
So, just looks like it just finished,
and there is your purple. I like my monitor better.
>> Yes, it looks pretty bad.
>> It's okay.
>> Fortunately we can change it in very quick succession.
>> Exactly. So, that's what we
wanted to show there with ACR build in App Service,
is really that quick three-step process,
that you can do things very quickly,
and the idea is, I know
John Papas got the other one where did AC Web App up,
he's been talking about and that is awesome.
>> So, what's the stages this is available.
Is this ready? Is this in preview? Can I use it today?
>> ACR build and we're
actually going to start calling it ACR tasks,
is in preview today.
We're going to be adding some more capabilities,
so you can do things like doing unit tests,
as part of that production do running of containers,
and the same model pre-commit,
then you can commit them, and
then you can do it with some framework patching.
So, it's in preview now and we're looking to GA very soon.
>> So, that I should go back and redo my video with
this new information and
see how much more smoothly that parcels with that.
>> We can start and try that
and I'm sure you'll find something that's good to work on.
>> Fantastic. I'm building
containers in the Cloud here on Azure Friday.
[MUSIC]