Skip to content

Commit 95aa7bd

Browse files
nrissclaude
andcommitted
pre-load FHIR packages in Docker image
Add fhir-packages.txt listing packages to bake into the image cache (~/.fhir/packages/). Supports "latest" keyword to resolve the most recent stable version at build time from packages2.fhir.org. Packages included: hl7.fhir.fr.core 2.1.0 & 2.2.0, ans.fhir.fr.annuaire 1.1.0, ans.fr.terminologies latest. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0a716a7 commit 95aa7bd

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

.github/workflows/build-docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [main]
66
paths:
77
- Dockerfile
8+
- fhir-packages.txt
89
- .github/workflows/build-docker.yml
910
schedule:
1011
# Rebuild hebdomadaire lundi 06:00 UTC pour capter les nouvelles versions SUSHI

Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,26 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
4848

4949
RUN java -version && node --version && sushi --version && jekyll --version && dot -V && python3 --version
5050

51+
# Pré-chargement du cache FHIR depuis fhir-packages.txt
52+
# Chaque package est stocké sous /root/.fhir/packages/<id>#<version>/
53+
COPY fhir-packages.txt /tmp/fhir-packages.txt
54+
RUN while IFS=' ' read -r pkg_id pkg_ver || [ -n "$pkg_id" ]; do \
55+
case "$pkg_id" in ''|\#*) continue ;; esac; \
56+
if [ "$pkg_ver" = "latest" ]; then \
57+
pkg_ver=$(curl -s "https://packages2.fhir.org/packages/${pkg_id}" | \
58+
python3 -c " \
59+
import sys, json, re; \
60+
d = json.load(sys.stdin); \
61+
versions = list(d.get('versions', {}).keys()); \
62+
stable = [v for v in versions if re.match(r'^\d+\.\d+\.\d+$', v)]; \
63+
print(stable[-1] if stable else versions[-1]) \
64+
"); \
65+
fi; \
66+
echo "Downloading ${pkg_id}#${pkg_ver} ..."; \
67+
mkdir -p /root/.fhir/packages/${pkg_id}\#${pkg_ver}; \
68+
curl -sL "https://packages2.fhir.org/packages/${pkg_id}/${pkg_ver}" \
69+
| tar -xz -C /root/.fhir/packages/${pkg_id}\#${pkg_ver}; \
70+
echo " -> OK"; \
71+
done < /tmp/fhir-packages.txt
72+
5173
WORKDIR /workspace

fhir-packages.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Packages FHIR pré-chargés dans l'image Docker (cache ~/.fhir/packages/)
2+
# Format : <package-id> <version>
3+
# Utiliser "latest" pour toujours installer la dernière version stable au moment du build.
4+
# Modifier ce fichier et pousser sur main pour déclencher un rebuild automatique de l'image.
5+
hl7.fhir.fr.core 2.1.0
6+
hl7.fhir.fr.core 2.2.0
7+
ans.fhir.fr.annuaire 1.1.0
8+
ans.fr.terminologies latest

0 commit comments

Comments
 (0)