Skip to content

Simplify container

Simplify container #45

Workflow file for this run

name: Container
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
env:
IMAGE_NAME: pynucleus
IMAGE_TAGS: latest ${{ github.sha }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
jobs:
container:
runs-on: ubuntu-latest
timeout-minutes: 300
steps:
- name: Set environment variables for PR
if: github.event_name == 'pull_request'
run: |
echo "IMAGE_TAGS=PR" >> $GITHUB_ENV
- name: Check out
if: always()
uses: actions/checkout@v4
with:
fetch-depth: 0
# - uses: hadolint/hadolint-action@v3.1.0
# with:
# dockerfile: Dockerfile
# ignore: 'DL3008,DL3013'
# verbose: true
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_TAGS }}
containerfiles: |
./Dockerfile
- name: Run tests
run: |
podman run -e MPIEXEC_FLAGS="--allow-run-as-root --oversubscribe" --workdir /pynucleus --rm ${{ steps.build_image.outputs.image }}:${{ github.sha }} python3 -m pytest --junit-xml=test-results.xml tests/
- name: Push To GHCR
uses: redhat-actions/push-to-registry@v2
id: push
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
extra-args: |
--disable-content-trust
- name: Echo outputs
run: |
echo "${{ toJSON(steps.push.outputs) }}"
- name: Slim the image
uses: kitabisa/docker-slim-action@v1
env:
DSLIM_HTTP_PROBE: false
with:
target: IMAGE_NAME:{{ steps.build_image.outputs.image }}
tag: "slim-{{ steps.build_image.outputs.tags }}"
- name: Push To GHCR
uses: redhat-actions/push-to-registry@v2
id: push

Check failure on line 80 in .github/workflows/container.yml

View workflow run for this annotation

GitHub Actions / Container

Invalid workflow file

The workflow is not valid. .github/workflows/container.yml (Line: 80, Col: 11): The identifier 'push' may not be used more than once within the same scope.
with:
image: ${{ steps.build_image.outputs.image }}
tags: slim-${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
extra-args: |
--disable-content-trust