Skip to content

Commit 20a830f

Browse files
committed
This fix adds the curated five-safes profile to the Docker image. Profile version is accessible through a label () or as an environment variable from inside the Docker image ().
1 parent 43a10fc commit 20a830f

3 files changed

Lines changed: 42 additions & 29 deletions

File tree

.github/workflows/build-with-profiles.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
env:
99
REGISTRY: ghcr.io
10-
IMAGE_NAME: ${{ github.repository }}-profiles
10+
IMAGE_NAME: ${{ github.repository }}-fivesafes-profile
1111

1212
jobs:
1313
build-and-push-image:
@@ -39,7 +39,7 @@ jobs:
3939
uses: docker/build-push-action@v6
4040
with:
4141
context: .
42-
file: ./Dockerfile.profiles
42+
file: ./Dockerfile.fivesafes-profile
4343
push: true
4444
tags: ${{ steps.meta.outputs.tags }}
4545
labels: ${{ steps.meta.outputs.labels }}

Dockerfile.fivesafes-profile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM python:3.11-slim
2+
3+
ARG FIVE_SAFES_PROFILE_VERSION=five-safes-0.7.3-beta
4+
ARG PROFILES_ARCHIVE_URL=https://github.com/eScienceLab/rocrate-validator/archive/refs/tags/${FIVE_SAFES_PROFILE_VERSION}.tar.gz
5+
6+
# Install required system packages, including git
7+
RUN apt-get update && apt-get install -y git wget && rm -rf /var/lib/apt/lists/*
8+
9+
WORKDIR /app
10+
11+
COPY requirements.txt .
12+
RUN pip install --upgrade pip
13+
RUN pip install --no-cache-dir -r requirements.txt
14+
15+
COPY cratey.py LICENSE /app/
16+
COPY app /app/app
17+
RUN <<EOF_WRF
18+
mkdir -p /app/profiles
19+
wget -O /tmp/rocrate-validator-profiles.tar.gz "$PROFILES_ARCHIVE_URL"
20+
tar -xzf /tmp/rocrate-validator-profiles.tar.gz \
21+
-C /app/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+
ENV PROFILES_PATH=/app/profiles
32+
33+
USER flaskuser
34+
35+
EXPOSE 5000
36+
37+
CMD ["flask", "run", "--host=0.0.0.0"]
38+
39+
LABEL org.opencontainers.image.source="https://github.com/eScienceLab/Cratey-Validator"
40+
LABEL org.cratey.five-safes-profile-version="${FIVE_SAFES_PROFILE_VERSION}"

Dockerfile.profiles

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)