Skip to content

Build and Push image #34

Build and Push image

Build and Push image #34

Workflow file for this run

name: Build and Push image
on:
# build only on user trigger
workflow_dispatch:
jobs:
build_and_push:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
actions: read
packages: write
name: Build and push border0/awx-ee image
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Configure the image RELEASE tag variables
run: |
BRANCH="${{ github.ref_name }}"
BRANCH=${BRANCH//\//_}
if [[ "$BRANCH" == "main" ]] ; then RELEASE="latest" ; else RELEASE="rc" ; fi
echo -e "RELEASE=${RELEASE}\nBRANCH=${BRANCH}" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
run: |
docker buildx create --name awx-ee-buildx
docker buildx use awx-ee-buildx
ansible-builder create -v3 --output-file=Dockerfile
docker buildx build \
--push \
--platform=linux/amd64 \
-t ghcr.io/${{ github.repository_owner }}/awx-ee:${RELEASE} \
-t ghcr.io/${{ github.repository_owner }}/awx-ee:${BRANCH} \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \
--label "org.opencontainers.image.description=Border0 AWX Execution Environment" \
--push context
docker buildx ls