forked from HealthIntersections/fhirserver
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 3.39 KB
/
linux-docker-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Build and Push Docker Image to GHCR
on:
# Trigger the workflow on push or pull request for the main branch
push:
pull_request:
jobs:
Build-Docker-Image:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository code
- name: Check out repository code
uses: actions/checkout@v2
# Step 2: Log in to GitHub Container Registry (GHCR)
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
# Step 3: Cache terminology files (optional, to avoid re-downloading terminology files)
- name: Cache terminology files
uses: actions/cache@v2
with:
path: ~/terminology
key: terminology-${{ github.sha }}
restore-keys: terminology-
# Step 4: Setup MySQL for the build
- name: Setup MySQL
run: |
docker network create gh
docker run \
--network gh \
--name mysql \
-e MYSQL_ROOT_PASSWORD=test \
-e MYSQL_USER=test \
-e MYSQL_PASSWORD=test \
-e MYSQL_DATABASE=test \
-d mysql:8
# Step 5: Convert repository owner and name to lowercase
- name: Convert repository owner and name to lowercase
id: vars
run: |
echo "org_name=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "repo_name=$(basename ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
# Step 6: Build the Docker image and tag it for GitHub Container Registry (GHCR)
- name: Docker Build
run: |
docker build --tag ghcr.io/${{ env.org_name }}/fhirserver:nightly .
# Step 7: Prepare ini file for your FHIR Server with environment variables
- name: Prepare ini file
env:
FHIRSERVER_LOCATIONS_CLONE_PATH: /work/fhirserver
FHIRSERVER_LOCATIONS_TEST_CASES_CLONE_PATH: /work/bootstrap/source/fhir-test-cases
FHIRSERVER_LOCATIONS_MARKDOWN_CLONE_PATH: /work/bootstrap/source/delphi-markdown
FHIRSERVER_LOCATIONS_SNOMED_CACHE_PATH: /terminology/fhir-server/snomed.test.cache
FHIRSERVER_MYSQL_SERVER: mysql
FHIRSERVER_EMAIL_SENDER: [email protected]
FHIRSERVER_EMAIL_DESTINATION: [email protected]
FHIRSERVER_EMAIL_PASSWORD: ${{ secrets.FHIRSERVER_EMAIL_PASSWORD }}
FHIRSERVER_SSL_CERT_PATH: /work/fhirserver/fixtures/domain.crt
FHIRSERVER_SSL_KEY_PATH: /work/fhirserver/fixtures/domain.key
FHIRSERVER_SSL_CACERT_PATH: /work/fhirserver/fixtures/rootCA.crt
FHIRSERVER_SSL_PASSWORD: password
run: |
cat fixtures/test-settings.ini.template | envsubst > ~/test-settings.ini
# Step 8: Ensure SNOMED cache is present
- name: Ensure SNOMED cache is present
run: |
mkdir -p ~/terminology/fhir-server
wget -q --no-clobber https://storage.googleapis.com/ig-build/snomed.test.cache -O ~/terminology/fhir-server/snomed.test.cache || true
ls ~/terminology/fhir-server/snomed.test.cache
# Step 9: Push the Docker image to GitHub Container Registry (GHCR)
- name: Push Docker image to GHCR
run: |
docker push ghcr.io/${{ env.org_name }}/fhirserver:nightly