diff --git a/.github/workflows/build-with-profiles.yml b/.github/workflows/build-with-profiles.yml new file mode 100644 index 0000000..ba77faf --- /dev/null +++ b/.github/workflows/build-with-profiles.yml @@ -0,0 +1,52 @@ +name: Create and publish a Docker image (with profiles) + +on: + release: + types: [published] + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}-fivesafes-profile + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile.fivesafes-profile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/Dockerfile.fivesafes-profile b/Dockerfile.fivesafes-profile new file mode 100644 index 0000000..df234b9 --- /dev/null +++ b/Dockerfile.fivesafes-profile @@ -0,0 +1,39 @@ +FROM python:3.11-slim + +ARG FIVE_SAFES_PROFILE_VERSION=five-safes-0.7.4-beta +ARG PROFILES_ARCHIVE_URL=https://github.com/eScienceLab/rocrate-validator/archive/refs/tags/${FIVE_SAFES_PROFILE_VERSION}.tar.gz +ARG PY_VER=3.11 + +# Install required system packages, including git +RUN apt-get update && apt-get install -y git wget && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --upgrade pip +RUN pip install --no-cache-dir -r requirements.txt + +COPY cratey.py LICENSE /app/ +COPY app /app/app +RUN <