11FROM python:3.11-slim
22
3- # Install required system packages, including git
4- RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
3+ # git is needed by some dependencies; wget is only used when baking a profile.
4+ RUN apt-get update && apt-get install -y git wget && rm -rf /var/lib/apt/lists/*
55
66WORKDIR /app
77
@@ -12,6 +12,22 @@ RUN pip install --no-cache-dir -r requirements.txt
1212COPY cratey.py LICENSE /app/
1313COPY app /app/app
1414
15+ # Optionally bake an extra RO-Crate profile into the validator's bundled
16+ # profiles directory. A plain build leaves PROFILES_ARCHIVE_URL empty and skips
17+ # this entirely; the "with profiles" image build passes these as --build-arg.
18+ # Baked profiles are then found automatically (no PROFILES_PATH needed).
19+ ARG PROFILES_ARCHIVE_URL=""
20+ ARG FIVE_SAFES_PROFILE_VERSION=""
21+ ARG PY_VER=3.11
22+ RUN if [ -n "$PROFILES_ARCHIVE_URL" ]; then \
23+ wget -O /tmp/profiles.tar.gz "$PROFILES_ARCHIVE_URL" && \
24+ tar -xzf /tmp/profiles.tar.gz \
25+ -C "/usr/local/lib/python${PY_VER}/site-packages/rocrate_validator/profiles/" \
26+ --strip-components=3 \
27+ "rocrate-validator-${FIVE_SAFES_PROFILE_VERSION}/rocrate_validator/profiles/five-safes-crate" && \
28+ rm /tmp/profiles.tar.gz ; \
29+ fi
30+
1531RUN useradd -ms /bin/bash flaskuser
1632RUN chown -R flaskuser:flaskuser /app
1733
@@ -21,4 +37,5 @@ EXPOSE 5000
2137
2238CMD ["flask" , "run" , "--host=0.0.0.0" ]
2339
24- LABEL org.opencontainers.image.source="https://github.com/eScienceLab/Cratey-Validator"
40+ LABEL org.opencontainers.image.source="https://github.com/eScienceLab/Cratey-Validator"
41+ LABEL org.cratey.five-safes-profile-version="${FIVE_SAFES_PROFILE_VERSION}"
0 commit comments