Skip to content

Commit

Permalink
Allow to build awx-ee from an arbitrary repo / branch and modify rece…
Browse files Browse the repository at this point in the history
…ptor source

Signed-off-by: Julen Landa Alustiza <[email protected]>
  • Loading branch information
Zokormazo committed Nov 8, 2022
1 parent ecf90c3 commit 6c46d25
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build_container_from_ref.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "Build container from arbitrary repo / ref"
on:
workflow_dispatch:
inputs:
repository:
description: 'The receptor repository to build from.'
required: true
default: 'ansible/awx-ee'
ref:
description: 'The ref to build. Can be a branch or any other valid ref.'
required: true
default: 'devel'
receptor_image:
description: 'The receptor image to use for the build'
required: true
default: 'quay.io/ansible/receptor:devel'
tag:
description: 'The tag for the container.'
required: true
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: ${{ github.event.inputs.repository }}
ref: ${{ github.event.inputs.ref }}

- uses: actions/setup-python@v2
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Login To ghcr.io
uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io

- name: Build and push image
env:
DOCKER_BUILDKIT: 1
TAG: ghcr.io/${{ github.repository }}:${{ github.event.inputs.tag }}
run: |
TAG=$(echo $TAG | tr '[A-Z]' '[a-z]')
tox -e docker -- --tag=$TAG --build-arg RECEPTOR_IMAGE=${{ github.event.inputs.receptor_image }}
docker push $TAG
3 changes: 2 additions & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ RUN assemble

FROM $EE_BASE_IMAGE
USER root
ARG RECEPTOR_IMAGE=quay.io/ansible/receptor:devel

COPY --from=galaxy /usr/share/ansible /usr/share/ansible

COPY --from=builder /output/ /output/
RUN /output/install-from-bindep && rm -rf /output/wheels
RUN alternatives --set python /usr/bin/python3
COPY --from=quay.io/ansible/receptor:devel /usr/bin/receptor /usr/bin/receptor
COPY --from=$RECEPTOR_IMAGE /usr/bin/receptor /usr/bin/receptor
RUN mkdir -p /var/run/receptor
ADD run.sh /run.sh
CMD /run.sh
Expand Down
4 changes: 3 additions & 1 deletion execution-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ dependencies:
system: _build/bindep.txt
python: _build/requirements.txt
additional_build_steps:
prepend: |
ARG RECEPTOR_IMAGE=quay.io/ansible/receptor:devel
append:
- RUN alternatives --set python /usr/bin/python3
- COPY --from=quay.io/ansible/receptor:devel /usr/bin/receptor /usr/bin/receptor
- COPY --from=$RECEPTOR_IMAGE /usr/bin/receptor /usr/bin/receptor
- RUN mkdir -p /var/run/receptor
- ADD run.sh /run.sh
- CMD /run.sh
Expand Down

0 comments on commit 6c46d25

Please sign in to comment.