diff --git a/.github/workflows/build_docker_images.yml b/.github/workflows/build_docker_images.yml index d919d27..09e4867 100644 --- a/.github/workflows/build_docker_images.yml +++ b/.github/workflows/build_docker_images.yml @@ -1,73 +1,74 @@ name: Build Docker Images on: + # Allows manual run from the Actions tab workflow_dispatch: - push: - branches: - - main - paths: - - 'Ubuntu/Dockerfile.buildenv.ubuntu' - - 'Ubuntu/Dockerfile.testenv.ubuntu' - - 'Ubuntu/Dockerfile.runtime.ubuntu' + inputs: + os_name: + description: 'Container OS' + required: true + default: 'ubuntu' + type: choice + options: + - 'ubuntu' + type: + description: 'Container type' + required: true + default: 'buildenv' + type: choice + options: + - 'buildenv' + - 'testenv' + - 'runtime' env: REGISTRY: ghcr.io + ORG_NAME: emod-hub # Must be lowercase jobs: build: - name: Build ${{ matrix.name }} + name: Build and push Docker image runs-on: ubuntu-latest + env: + DFILE_NAME: ${{ format('Dockerfile.{0}.{1}', inputs.type, inputs.os_name) }} + IMAGE_NAME: ${{ format('emod-{0}-{1}', inputs.os_name, inputs.type) }} permissions: - contents: read + artifact-metadata: write + attestations: write + id-token: write packages: write - strategy: - fail-fast: false - matrix: - include: - - name: buildenv - dockerfile: Dockerfile.buildenv.ubuntu - image: emod-ubuntu-buildenv - context: Ubuntu - - name: testenv - dockerfile: Dockerfile.testenv.ubuntu - image: emod-ubuntu-testenv - context: Ubuntu - - name: runtime - dockerfile: Dockerfile.runtime.ubuntu - image: emod-ubuntu-runtime - context: Ubuntu - steps: - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set lower-case image ref - id: image - run: | - OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') - echo "ref=${{ env.REGISTRY }}/${OWNER}/${{ matrix.image }}" >> $GITHUB_OUTPUT - + uses: actions/checkout@v6 - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 - name: Extract metadata id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@v6 with: - images: ${{ steps.image.outputs.ref }} + images: ${{ env.REGISTRY }}/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest,enable={{is_default_branch}} type=sha,prefix=sha- - - name: Build and push - uses: docker/build-push-action@v6 + id: push + uses: docker/build-push-action@v7 with: - context: ${{ matrix.context }} - file: Ubuntu/${{ matrix.dockerfile }} + context: ./${{ inputs.os_name}} + file: ${{ inputs.os_name}}/${{ env.DFILE_NAME }} push: true - tags: ${{ steps.meta.outputs.tags }} + sbom: true + tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + - name: Generate artifact attestation + uses: actions/attest@v4 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/CentOS/Dockerfile.buildenv.centos b/centos/Dockerfile.buildenv.centos similarity index 100% rename from CentOS/Dockerfile.buildenv.centos rename to centos/Dockerfile.buildenv.centos diff --git a/centos/README.md b/centos/README.md new file mode 100644 index 0000000..7c08ae3 --- /dev/null +++ b/centos/README.md @@ -0,0 +1,5 @@ +# CentOS Docker Images + +This directory contains legacy Dockerfile image definitions for building and running EMOD on CentOS 7. + +CentOS is a discontinued Linux distribution; these image definitions are deprecated. diff --git a/Ubuntu/Dockerfile.buildenv.ubuntu b/ubuntu/Dockerfile.buildenv.ubuntu similarity index 100% rename from Ubuntu/Dockerfile.buildenv.ubuntu rename to ubuntu/Dockerfile.buildenv.ubuntu diff --git a/Ubuntu/Dockerfile.runtime.ubuntu b/ubuntu/Dockerfile.runtime.ubuntu similarity index 100% rename from Ubuntu/Dockerfile.runtime.ubuntu rename to ubuntu/Dockerfile.runtime.ubuntu diff --git a/Ubuntu/Dockerfile.testenv.ubuntu b/ubuntu/Dockerfile.testenv.ubuntu similarity index 100% rename from Ubuntu/Dockerfile.testenv.ubuntu rename to ubuntu/Dockerfile.testenv.ubuntu diff --git a/Ubuntu/README.md b/ubuntu/README.md similarity index 100% rename from Ubuntu/README.md rename to ubuntu/README.md diff --git a/Ubuntu/requirements.buildenv.txt b/ubuntu/requirements.buildenv.txt similarity index 100% rename from Ubuntu/requirements.buildenv.txt rename to ubuntu/requirements.buildenv.txt diff --git a/Ubuntu/requirements.runtime.txt b/ubuntu/requirements.runtime.txt similarity index 100% rename from Ubuntu/requirements.runtime.txt rename to ubuntu/requirements.runtime.txt diff --git a/Ubuntu/requirements.testenv.txt b/ubuntu/requirements.testenv.txt similarity index 100% rename from Ubuntu/requirements.testenv.txt rename to ubuntu/requirements.testenv.txt