File tree Expand file tree Collapse file tree 2 files changed +91
-0
lines changed
Expand file tree Collapse file tree 2 files changed +91
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Create and publish a Docker image (with profiles)
2+
3+ on :
4+ release :
5+ types : [published]
6+ workflow_dispatch :
7+
8+ env :
9+ REGISTRY : ghcr.io
10+ IMAGE_NAME : ${{ github.repository }}-fivesafes-profile
11+
12+ jobs :
13+ build-and-push-image :
14+ runs-on : ubuntu-latest
15+ permissions :
16+ contents : read
17+ packages : write
18+ attestations : write
19+ id-token : write
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v4
23+
24+ - name : Log in to the Container registry
25+ uses : docker/login-action@v3
26+ with :
27+ registry : ${{ env.REGISTRY }}
28+ username : ${{ github.actor }}
29+ password : ${{ secrets.GITHUB_TOKEN }}
30+
31+ - name : Extract metadata (tags, labels) for Docker
32+ id : meta
33+ uses : docker/metadata-action@v5
34+ with :
35+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+
37+ - name : Build and push Docker image
38+ id : push
39+ uses : docker/build-push-action@v6
40+ with :
41+ context : .
42+ file : ./Dockerfile.fivesafes-profile
43+ push : true
44+ tags : ${{ steps.meta.outputs.tags }}
45+ labels : ${{ steps.meta.outputs.labels }}
46+
47+ - name : Generate artifact attestation
48+ uses : actions/attest-build-provenance@v2
49+ with :
50+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
51+ subject-digest : ${{ steps.push.outputs.digest }}
52+ push-to-registry : true
Original file line number Diff line number Diff line change 1+ FROM python:3.11-slim
2+
3+ ARG FIVE_SAFES_PROFILE_VERSION=five-safes-0.7.4-beta
4+ ARG PROFILES_ARCHIVE_URL=https://github.com/eScienceLab/rocrate-validator/archive/refs/tags/${FIVE_SAFES_PROFILE_VERSION}.tar.gz
5+ ARG PY_VER=3.11
6+
7+ # Install required system packages, including git
8+ RUN apt-get update && apt-get install -y git wget && rm -rf /var/lib/apt/lists/*
9+
10+ WORKDIR /app
11+
12+ COPY requirements.txt .
13+ RUN pip install --upgrade pip
14+ RUN pip install --no-cache-dir -r requirements.txt
15+
16+ COPY cratey.py LICENSE /app/
17+ COPY app /app/app
18+ RUN <<EOF_WRF
19+ wget -O /tmp/rocrate-validator-profiles.tar.gz "$PROFILES_ARCHIVE_URL"
20+ tar -xzf /tmp/rocrate-validator-profiles.tar.gz \
21+ -C /usr/local/lib/python${PY_VER}/site-packages/rocrate_validator/profiles/ \
22+ --strip-components=3 \
23+ "rocrate-validator-${FIVE_SAFES_PROFILE_VERSION}/rocrate_validator/profiles/five-safes-crate"
24+ rm /tmp/rocrate-validator-profiles.tar.gz
25+ EOF_WRF
26+
27+ RUN useradd -ms /bin/bash flaskuser
28+ RUN chown -R flaskuser:flaskuser /app
29+
30+ ENV FIVE_SAFES_PROFILE_VERSION=${FIVE_SAFES_PROFILE_VERSION}
31+
32+ USER flaskuser
33+
34+ EXPOSE 5000
35+
36+ CMD ["flask", "run", "--host=0.0.0.0"]
37+
38+ LABEL org.opencontainers.image.source="https://github.com/eScienceLab/Cratey-Validator"
39+ LABEL org.cratey.five-safes-profile-version="${FIVE_SAFES_PROFILE_VERSION}"
You can’t perform that action at this time.
0 commit comments