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

install latest azd version on containers #1766

Closed
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ FROM --platform=amd64 mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update && apt-get install -y xdg-utils \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://aka.ms/install-azd.sh | bash
RUN curl -fsSL https://aka.ms/install-azd.sh | sudo bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does adding sudo change which version is installed? Or are you saying that a different version was installed in another CI step and this was failing previously?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tried locally and this curl .... | bash just fails during docker build, leaving just a previous azd version installed within the container.
I tried in WSL2. As soon as I add the sudo there, I get latest version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vhvb1989 Do you recall what output you got from install-azd.sh when you ran it without sudo? I am surprised that this is required. I would have expected that the inside the container the step was running at root (note, for example, how we are able to run a bunch of apt-get commands that should require root as well).

I don't doubt we have an issue here - but I'm trying to better understand what it was and why this ends up fixing it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I tried again and of course it is working fine now.

So, my new hypothesis is that docker is just skipping the re-build of a layer that it previously build, because it has no changes. So, I built the container some time ago, before azd-release, and now, even thought there's a new release, docker is using the same pre-built layer for me, as I haven't changed the dockerfile.

I think this is not an azd issue, or installer.

The fact that adding sudo was working, was only because I was updating the dockerfile, forcing docker to re-compile the layer.

What we could do to help devcontiners not to fall into this issue is to remove the azd-installation as a docker-layer and instead support adding config to devcontainer.json to request azd to be installed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue created: #1776

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > mic
&& apt-get update && apt-get install -y xdg-utils \
&& apt-get update && apt-get install -y azure-functions-core-tools-4 \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://aka.ms/install-azd.sh | bash
RUN curl -fsSL https://aka.ms/install-azd.sh | sudo bash