azuredockerazure-devopsrelease-managementazure-bicep

How to choose and download specific release version of Azure Bicep?


In my docker image, I currently specify the download of the bicep module from GitHub as suggested in the Azure Documentation.

# Install Bicep
RUN curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64
RUN chmod +x ./bicep
RUN mv ./bicep /usr/local/bin/bicep

Now, I want to fix the version of the bicep to be v0.23.1. Do you know how to achieve that? I played around with the link, but I did not manage to get the path. For example, I tried without success:

 curl -Lo bicep https://github.com/Azure/bicep/releases/download/v0.23.1/bicep-linux-x64

I suppose I need something more sophisticated than curl -Lo. Can someone give me a hint on how I get specific release assets from git?

Solution: For reference the above curl statement with version works for the docker file. I had a problem with my ps rule configurations, which I was trying to fix at the same time. For those who might need it, this is how the ps-rule.yml can be configured:

requires:
  # Require PSRule for Azure v1.30.1
  PSRule: '2.9.0'
  PSRule.Rules.Azure: '1.30.1'

Solution

  • Try this Dockerfile (or adapt it to fit into your existing Dockerfile):

    FROM ubuntu:23.04
    
    RUN apt-get update -qq -y && apt-get install -qq -y curl libicu-dev
    RUN curl -Lo bicep https://github.com/Azure/bicep/releases/download/v0.23.1/bicep-linux-x64 && \
        chmod +x bicep && \
        mv bicep /usr/local/bin/bicep
    

    📌 You also need to install libicu-dev in order to run bicep.

    Then fire up a container and test:

    root@b20d3a793186:/# bicep --version
    Bicep CLI version 0.23.1 (b02de2da48)