I have a pipeline on Azure DevOps and this is the YAML file.
trigger:
- main
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: 'xxx'
imageRepository: 'shinyproxyimage'
containerRegistry: 'myrepo.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/DOCKERFILE'
tag: '$(Build.BuildId)'
# Agent VM image name
vmImageName: 'ubuntu-latest'
stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
latest
Also, I have a DOCKERFILE and this is an example:
FROM openanalytics/r-base
LABEL maintainer "Enrico Rossini <enrico.rossini.uk@live.com>"
ARG project=testApp
# install Debian dependencies for R
RUN apt-get update && apt-get install -y \
sudo \
pandoc \
pandoc-citeproc \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
libssl-dev \
libssh2-1-dev \
libxml2-dev \
libgit2-dev
# packages needed renv and install
RUN R -e "install.packages(c('renv', 'devtools'),
repos='https://cloud.r-project.org'); renv::consent(provided = TRUE)"
RUN R -e "install.packages('shiny', repos='http://cran.rstudio.com')"
RUN R -e "install.packages('shinydashboard', repos='http://cran.rstudio.com')"
RUN R -e "install.packages('shinythemes', repos='http://cran.rstudio.com')"
# create root folder for app in container
RUN mkdir /root/${project}
# copy the app to the image
COPY app /root/${project}
#COPY inst/shiny-server.conf /etc/shiny-server/shiny-server.conf
COPY Rprofile.site /usr/lib/R/etc/
EXPOSE 3838
CMD ["R", "-e", "shiny::runApp('/root/testApp')"]
I want to use variables from the Library in both files (azure-pipeline.yml and DOCKERFILE). I saw this other post but there the guy is using a classic pipeline not a YAML file.
Is there a way to use variables from the library from Azure DevOps?