Skip to content

Commit

Permalink
Merge pull request #32 from elimuinformatics/update-fork
Browse files Browse the repository at this point in the history
Update fork
  • Loading branch information
shubhamparikh927 authored Dec 23, 2021
2 parents ba3c332 + 7a3f27c commit 37d3444
Show file tree
Hide file tree
Showing 77 changed files with 22,680 additions and 682 deletions.
11 changes: 10 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
target
target/classes/
target/failsafe-reports/
target/generated-*
target/maven-*
target/ROOT
target/test-classes/
target/war
target/duplicate-finder-result.xml
target/jacoco.exec
target/*.original
.idea
.git
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[*.java]
charset = utf-8
indent_style = space
indent_size = 2
indent_style = tab
indent_size = 3

23 changes: 23 additions & 0 deletions .github/ct/chart-schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: str()
home: str()
version: str()
apiVersion: str()
appVersion: any(str(), num(), required=False)
type: str()
dependencies: any(required=False)
description: str()
keywords: list(str(), required=False)
sources: list(str(), required=False)
maintainers: list(include('maintainer'), required=False)
icon: str(required=False)
engine: str(required=False)
condition: str(required=False)
tags: str(required=False)
deprecated: bool(required=False)
kubeVersion: str(required=False)
annotations: map(str(), str(), required=False)
---
maintainer:
name: str()
email: str(required=False)
url: str(required=False)
16 changes: 16 additions & 0 deletions .github/ct/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
debug: true
remote: origin
chart-yaml-schema: .github/ct/chart-schema.yaml
validate-maintainers: false
validate-chart-schema: true
validate-yaml: true
check-version-increment: true
chart-dirs:
- charts
helm-extra-args: --timeout 300s
upgrade: true
skip-missing-values: true
release-label: release
chart-repos:
- bitnami=https://charts.bitnami.com/bitnami
release-name-template: "helm-v{{ .Version }}"
84 changes: 84 additions & 0 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build Container Images

on:
push:
tags:
- "image/v*"
paths-ignore:
- "charts/**"
pull_request:
branches: [master]
paths-ignore:
- "charts/**"
env:
IMAGES: docker.io/hapiproject/hapi
PLATFORMS: linux/amd64,linux/arm64/v8

jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
with:
images: ${{ env.IMAGES }}
tags: |
type=match,pattern=image-(.*),group=1,enable=${{github.event_name != 'pull_request'}}
type=sha
- name: Docker distroless meta
id: docker_distroless_meta
uses: docker/metadata-action@v3
with:
images: ${{ env.IMAGES }}
tags: |
type=match,pattern=image-(.*),group=1,enable=${{github.event_name != 'pull_request'}}
type=sha
flavor: |
suffix=-distroless,onlatest=true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
platforms: ${{ env.PLATFORMS }}

- name: Build and push distroless
id: docker_build_distroless
uses: docker/build-push-action@v2
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_distroless_meta.outputs.tags }}
labels: ${{ steps.docker_distroless_meta.outputs.labels }}
platforms: ${{ env.PLATFORMS }}
target: release-distroless
40 changes: 40 additions & 0 deletions .github/workflows/chart-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release Charts

on:
push:
branches:
- master
paths:
- "charts/**"

jobs:
release:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.7.0

- name: Add bitnami repo
run: helm repo add bitnami https://charts.bitnami.com/bitnami

- name: Update dependencies
run: find charts/ ! -path charts/ -maxdepth 1 -type d -exec helm dependency update {} \;

- name: Run chart-releaser
uses: helm/[email protected]
with:
config: .github/ct/config.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
68 changes: 68 additions & 0 deletions .github/workflows/chart-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Lint and Test Charts

on:
pull_request:
branches:
- master
paths:
- "charts/**"

jobs:
lint:
runs-on: ubuntu-20.04
container: quay.io/helmpack/chart-testing:v3.4.0
steps:
- name: Install helm-docs
working-directory: /tmp
env:
HELM_DOCS_URL: https://github.com/norwoodj/helm-docs/releases/download/v1.5.0/helm-docs_1.5.0_Linux_x86_64.tar.gz
run: |
curl -LSs $HELM_DOCS_URL | tar xz && \
mv ./helm-docs /usr/local/bin/helm-docs && \
chmod +x /usr/local/bin/helm-docs && \
helm-docs --version
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Check if documentation is up-to-date
run: helm-docs && git diff --exit-code HEAD

- name: Run chart-testing (lint)
run: ct lint --config .github/ct/config.yaml

test:
runs-on: ubuntu-20.04
needs:
- lint
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.7.0

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .github/ct/config.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Create k8s Kind Cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: ct install --config .github/ct/config.yaml
if: steps.list-changed.outputs.changed == 'true'
3 changes: 2 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ name: Java CI with Maven

on:
push:
branches: [ master ]
branches:
- '**'
pull_request:
branches: [ master ]

Expand Down
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ local.properties

# STS (Spring Tool Suite)
.springBeans
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

# Code Recommenders
.recommenders/
Expand Down Expand Up @@ -157,4 +164,7 @@ Icon
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
.apdisk

# Helm Chart dependencies
**/charts/*.tgz
26 changes: 21 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
FROM maven:3.6.3-jdk-11-slim as build-hapi
FROM maven:3.8.2-jdk-11-slim as build-hapi
WORKDIR /tmp/hapi-fhir-jpaserver-starter

COPY pom.xml .
COPY server.xml .
RUN mvn -ntp dependency:go-offline

COPY src/ /tmp/hapi-fhir-jpaserver-starter/src/
RUN mvn clean install -DskipTests

FROM tomcat:9.0.38-jdk11-openjdk-slim-buster
FROM build-hapi AS build-distroless
RUN mvn package spring-boot:repackage -Pboot
RUN mkdir /app && \
cp /tmp/hapi-fhir-jpaserver-starter/target/ROOT.war /app/main.war

RUN mkdir -p /data/hapi/lucenefiles && chmod 775 /data/hapi/lucenefiles && rm -rf /usr/local/tomcat/webapps/ROOT
COPY --from=build-hapi /tmp/hapi-fhir-jpaserver-starter/target/*.war /usr/local/tomcat/webapps/ROOT.war
FROM gcr.io/distroless/java-debian11:11 AS release-distroless
COPY --chown=nonroot:nonroot --from=build-distroless /app /app
# 65532 is the nonroot user's uid
# used here instead of the name to allow Kubernetes to easily detect that the container
# is running as a non-root (uid != 0) user.
USER 65532:65532
WORKDIR /app
CMD ["/app/main.war"]

EXPOSE 8080
FROM tomcat:9.0.53-jdk11-openjdk-slim-bullseye

RUN mkdir -p /data/hapi/lucenefiles && chmod 775 /data/hapi/lucenefiles
COPY --from=build-hapi /tmp/hapi-fhir-jpaserver-starter/target/*.war /usr/local/tomcat/webapps/

COPY catalina.properties /usr/local/tomcat/conf/catalina.properties
COPY server.xml /usr/local/tomcat/conf/server.xml

CMD ["catalina.sh", "run"]
Loading

0 comments on commit 37d3444

Please sign in to comment.