-
Notifications
You must be signed in to change notification settings - Fork 0
Added dockerfile and workflow to build Docker image with baked-in five-safes profile #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
douglowe
merged 4 commits into
develop
from
135-add-release-triggered-github-actions-workflow-to-build-docker-image-with-baked-in-profiles
Mar 13, 2026
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
43a10fc
Added dockerfile and workflow to build Docker image with baked-in pro…
EttoreM 20a830f
This fix adds the curated five-safes profile to the Docker image. Pro…
EttoreM ae4d227
The five-safes profile is now baked into the default directory. Also,…
EttoreM 94dd10a
Removed stale lines from Dockerfile.fivesafes-profile.
EttoreM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| FROM python:3.11-slim | ||
|
|
||
| ARG FIVE_SAFES_PROFILE_VERSION=five-safes-0.7.3-beta | ||
| ARG PROFILES_ARCHIVE_URL=https://github.com/eScienceLab/rocrate-validator/archive/refs/tags/${FIVE_SAFES_PROFILE_VERSION}.tar.gz | ||
|
|
||
| # 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 <<EOF_WRF | ||
| mkdir -p /app/profiles | ||
| wget -O /tmp/rocrate-validator-profiles.tar.gz "$PROFILES_ARCHIVE_URL" | ||
| tar -xzf /tmp/rocrate-validator-profiles.tar.gz \ | ||
| -C /app/profiles \ | ||
| --strip-components=3 \ | ||
| "rocrate-validator-${FIVE_SAFES_PROFILE_VERSION}/rocrate_validator/profiles/five-safes-crate" | ||
| rm /tmp/rocrate-validator-profiles.tar.gz | ||
| EOF_WRF | ||
|
|
||
| RUN useradd -ms /bin/bash flaskuser | ||
| RUN chown -R flaskuser:flaskuser /app | ||
|
|
||
| ENV FIVE_SAFES_PROFILE_VERSION=${FIVE_SAFES_PROFILE_VERSION} | ||
| ENV PROFILES_PATH=/app/profiles | ||
|
|
||
| USER flaskuser | ||
|
|
||
| EXPOSE 5000 | ||
|
|
||
| CMD ["flask", "run", "--host=0.0.0.0"] | ||
|
|
||
| LABEL org.opencontainers.image.source="https://github.com/eScienceLab/Cratey-Validator" | ||
| LABEL org.cratey.five-safes-profile-version="${FIVE_SAFES_PROFILE_VERSION}" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.