Skip to content

Commit a51f839

Browse files
nrissclaude
andcommitted
add Dockerfile and build workflow for ghcr.io/ansforge/fhir-ig-builder
Colocating the Dockerfile in IG-workflows so the GITHUB_TOKEN (scoped to ansforge) can push directly to ghcr.io/ansforge/. Weekly cron rebuild picks up new SUSHI versions automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4c28665 commit a51f839

2 files changed

Lines changed: 120 additions & 0 deletions

File tree

.github/workflows/build-docker.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build and Push FHIR IG Builder image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- Dockerfile
8+
- .github/workflows/build-docker.yml
9+
schedule:
10+
# Rebuild hebdomadaire lundi 06:00 UTC pour capter les nouvelles versions SUSHI
11+
- cron: '0 6 * * 1'
12+
workflow_dispatch:
13+
inputs:
14+
sushi_version:
15+
description: 'Version SUSHI à installer (défaut : dernière stable)'
16+
required: false
17+
default: ''
18+
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
jobs:
24+
build-and-push:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Resolve SUSHI version
30+
id: sushi-version
31+
shell: bash
32+
run: |
33+
if [ -n "${{ github.event.inputs.sushi_version }}" ]; then
34+
VERSION="${{ github.event.inputs.sushi_version }}"
35+
else
36+
VERSION=$(npm view fsh-sushi version)
37+
fi
38+
echo "version=$VERSION" >> $GITHUB_OUTPUT
39+
echo "SUSHI version: $VERSION"
40+
41+
- name: Log in to GitHub Container Registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Set up Docker Buildx
49+
uses: docker/setup-buildx-action@v3
50+
51+
- name: Build and push
52+
uses: docker/build-push-action@v5
53+
with:
54+
context: .
55+
push: true
56+
build-args: SUSHI_VERSION=${{ steps.sushi-version.outputs.version }}
57+
tags: |
58+
ghcr.io/ansforge/fhir-ig-builder:latest
59+
ghcr.io/ansforge/fhir-ig-builder:sushi-${{ steps.sushi-version.outputs.version }}
60+
cache-from: type=gha
61+
cache-to: type=gha,mode=max
62+
63+
- name: Verify image
64+
run: |
65+
docker run --rm ghcr.io/ansforge/fhir-ig-builder:latest sushi --version
66+
docker run --rm ghcr.io/ansforge/fhir-ig-builder:latest java -version
67+
docker run --rm ghcr.io/ansforge/fhir-ig-builder:latest jekyll --version
68+
docker run --rm ghcr.io/ansforge/fhir-ig-builder:latest dot -V
69+
docker run --rm ghcr.io/ansforge/fhir-ig-builder:latest python3 --version

Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FROM ubuntu:24.04
2+
3+
ARG SUSHI_VERSION=3.20.0
4+
ARG NODE_MAJOR=20
5+
ENV DEBIAN_FRONTEND=noninteractive \
6+
LANG=en_US.UTF-8 \
7+
LC_ALL=en_US.UTF-8
8+
9+
# System packages
10+
RUN apt-get update && apt-get install -y --no-install-recommends \
11+
ca-certificates \
12+
curl \
13+
wget \
14+
git \
15+
jq \
16+
unzip \
17+
graphviz \
18+
python3 \
19+
python3-pip \
20+
ruby \
21+
ruby-dev \
22+
ruby-bundler \
23+
build-essential \
24+
openjdk-17-jdk-headless \
25+
locales \
26+
&& locale-gen en_US.UTF-8 \
27+
&& rm -rf /var/lib/apt/lists/*
28+
29+
# Node.js 20 via NodeSource
30+
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_MAJOR}.x | bash - \
31+
&& apt-get install -y nodejs \
32+
&& rm -rf /var/lib/apt/lists/*
33+
34+
# SUSHI (version épinglée via ARG — passer --build-arg SUSHI_VERSION=x.y.z pour mettre à jour)
35+
RUN npm install -g fsh-sushi@${SUSHI_VERSION}
36+
37+
# Jekyll
38+
RUN gem install jekyll --no-document
39+
40+
# GitHub CLI
41+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
42+
| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
43+
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
44+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
45+
| tee /etc/apt/sources.list.d/github-cli.list \
46+
&& apt-get update && apt-get install -y gh \
47+
&& rm -rf /var/lib/apt/lists/*
48+
49+
RUN java -version && node --version && sushi --version && jekyll --version && dot -V && python3 --version
50+
51+
WORKDIR /workspace

0 commit comments

Comments
 (0)