Skip to content

.github/workflows/push-release-image-test.yaml #6

.github/workflows/push-release-image-test.yaml

.github/workflows/push-release-image-test.yaml #6

name: Test docker image
on:
workflow_dispatch:
# no content, allows manual triggering
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # required to access tags
submodules: "true"
- name: Build & run devcontainer image
# this always builds a new image from scratch rather than from the build-devcontainer-image workflow output
# so that we pick up the latest versions of everything
# NB: if you update this also update live-validation.yml
id: devcontainer
run: |
docker build --tag devcontainer:latest .devcontainer
mkdir -p $HOME/.docker # in case it doesn't exist
container_id=$(docker create -w /workspace -v $GITHUB_WORKSPACE:/workspace -v /var/run/docker.sock:/var/run/docker.sock devcontainer:latest)
docker start "$container_id"
echo "container_id=$container_id" >> $GITHUB_ENV
- name: Login to registry
# note that all creds are on host and never passed into devcontainer
uses: docker/login-action@v3
with:
registry: harshdsingh.azurecr.io
username: ${{ secrets.AZURE_CLIENT_ID }}
password: ${{ secrets.AZURE_CLIENT_SECRET }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Push docker image
run: |
container_id=${{env.container_id}}
docker exec -e DOCKER_PUSH_TARGET "$container_id" task controller:docker-push-multiarch
env:
DOCKER_PUSH_TARGET: harshdsingh.azurecr.io