Build docker image

This section shows how to build a docker image of GameBus FHIR layer from three repos of healthcare-data-harmonization (mapping engine), mapping_config and gamebus-fhir-layer (FHIR server).

Requirement

Install the following software

After installation, check the version of buildx` by running

docker buildx version

Make sure it has a version >=0.8.

Using remote code

We can build a docker image of GameBus FHIR layer from the remote GitHub repos:

The last repo contains the Dockerfile used to build the docker image. So first we need to clone this repo

git clone https://github.com/nwo-strap/gamebus-fhir-layer.git

# make sure you work in the "gamebus-fhir-layer" repo
cd gamebus-fhir-layer

Then, build the docker image

docker buildx build --no-cache=true -t gamebus-fhir-layer .

This command will build a docker image with the name gambus-fhir-layer.

By default, the source code from the latest commit of main or master branch of each repo will be used to build the docker image.

To use the source code of different versions, you could provide a branch name, commit , or tag name to the buildx command:

docker buildx build --no-cache=true -t gamebus-fhir-layer \
    --build-arg GW_VERSION=[gitBranch_orCommit_orTag] \
    --build-arg GW_CONFIG_VERSION=[gitBranch_orCommit_orTag] \
    --build-arg GAMEBUS_FHIR_VERSION=[gitBranch_orCommit_orTag] \
    .

Replace the [gitBranch_orCommit_orTag] with real values.

Using local code

It’s also possible to build a docker image directly from local repos. It helps a lot to test new code before pushing them to remote.

First, make sure the three repos locate in the same place. You can clone them if needed

git clone https://github.com/nwo-strap/healthcare-data-harmonization
git clone https://github.com/nwo-strap/mapping_configs
git clone https://github.com/nwo-strap/gamebus-fhir-layer

Then, build the docker image

# make sure you work in the "gamebus-fhir-layer" repo
cd gambus-fhir-layer

# build docker image
docker buildx build --no-cache=true -t gamebus-fhir-layer \
    --build-context gw-src=../healthcare-data-harmonization \
    --build-context gw-config-src=../mapping_configs \
    --build-context gamebus-fhir-src=. \
    .

The --build-context argument sets which local repo to use. You need to set an absolute path to this argument if your repos are not in the same place.