-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker/Development Containers support #1406
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "Synthea - synthetic patient data generator", | ||
"build": { | ||
"context": "..", | ||
"dockerfile": "../Dockerfile", | ||
"args": { "BASE_IMAGE": "mcr.microsoft.com/devcontainers/base:ubuntu", "USER": "vscode" } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/.devcontainer | ||
/.hermit | ||
|
||
**/.DS_Store | ||
.classpath | ||
.project | ||
.settings | ||
.gradle | ||
/nbproject/** | ||
/build/** | ||
|
||
/.gradle/ | ||
/bin/main | ||
/bin/test | ||
|
||
/failed_exports/ | ||
/output/ | ||
/out/ | ||
|
||
**/*.log | ||
|
||
# don't commit the autobuilt version file | ||
src/main/resources/version.txt | ||
|
||
# don't commit the code maps | ||
src/main/resources/export/condition_code_map.json | ||
src/main/resources/export/medication_code_map.json | ||
src/main/resources/export/drg_code_map.json | ||
src/main/resources/export/dme_code_map.json | ||
src/main/resources/export/hcpcs_code_map.json | ||
src/main/resources/export/betos_code_map.json | ||
src/main/resources/export/external_codes.csv | ||
src/main/resources/export/snf_pdpm_code_map.json | ||
src/main/resources/export/snf_pps_code_map.json | ||
src/main/resources/export/snf_rev_cntr_code_map.json | ||
src/main/resources/export/hha_rev_cntr_code_map.json | ||
src/main/resources/export/hha_pps_case_mix_codes.csv | ||
src/main/resources/export/hha_pps_pdgm_codes.csv | ||
src/main/resources/export/hospice_rev_cntr_code_map.json | ||
src/main/resources/export/inpatient_rev_cntr_code_map.json | ||
src/main/resources/export/outpatient_rev_cntr_code_map.json | ||
|
||
# H2 database files | ||
**/*.mv.db | ||
**/*.trace.db | ||
|
||
# VS Code launch settings | ||
.vscode/launch.test.json | ||
.vscode/launch.json | ||
.vscode/settings.json | ||
/build/ | ||
|
||
# VS Code plugin files | ||
.history |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# Top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# Set default charset | ||
charset = utf-8 | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
# 4 space indentation (default) | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# 2 space indentation | ||
[*.{bicep,bicepparam,html,js,jsx,ts,tsx,json,sass,yaml,yml}] | ||
indent_size = 2 | ||
|
||
# Trim trailing whitespace | ||
trim_trailing_whitespace = true | ||
|
||
# Max line length | ||
max_line_length = 80 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
ARG BASE_IMAGE=ubuntu:22.04 | ||
FROM ${BASE_IMAGE} | ||
|
||
ARG USER=dev | ||
|
||
WORKDIR /work | ||
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"] | ||
|
||
# setup timezone | ||
RUN apt-get update;\ | ||
apt-get install -yq tzdata;\ | ||
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime;\ | ||
dpkg-reconfigure -f noninteractive tzdata; | ||
|
||
# Set the locale | ||
RUN apt-get install -yq locales; | ||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ | ||
locale-gen | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
# install OS deps | ||
RUN set -eux;\ | ||
apt-get install -y --no-install-recommends ca-certificates curl git jq make unzip zip; | ||
RUN set -eux;\ | ||
apt-get install -y --no-install-recommends libfreetype-dev libfreetype6 fontconfig fonts-dejavu;\ | ||
rm -rf /var/lib/apt/lists/*; | ||
|
||
# run as non-root user | ||
RUN id -u ${USER} &>/dev/null || useradd -ms /bin/bash ${USER} | ||
USER ${USER} | ||
WORKDIR /home/${USER}/work | ||
|
||
COPY --chown=${USER}:${USER} ./ ./synthea | ||
|
||
# install hermit and binary deps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is unclear to me why you would want to use hermit in a Docker environment. I understand that hermit allows you to specify the exact version of tools that you want to use for development, such as the JDK. That said, you can do the same thing with plain Docker. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can, but we've used hermit in Dockerfiles for years with great success. hermit provides a simple way to ensure local environment binary tools exactly match docker container tools. and it simplifies installation (no need to look up the exact installation URL and procedure for each tool |
||
COPY --chown=${USER}:${USER} bin/ bin/ | ||
ENV PATH=/home/${USER}/work/bin:${PATH} | ||
RUN set -eux;\ | ||
hermit shell-hooks;\ | ||
hermit install | ||
|
||
COPY --chown=${USER}:${USER} ./ ./synthea | ||
RUN set -eux;\ | ||
cd synthea;\ | ||
make install;\ | ||
make build; | ||
|
||
# Synthea repo: https://github.com/synthetichealth/synthea | ||
# ./synthea/run_synthea -m congestive_heart_failure -c settings-chf.yml -p 10000 | ||
# ./synthea/run_synthea -c settings-chf.yml -p 10000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.PHONY: build install visualize | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Synthea uses gradle for its build system. Adding a Makefile replicates gradle functionality and will likely lead to confusion for users. The project does not incorporate any tool management systems such as hermit, SDKMAN or jabba. Doing so would likely cause issues for users who may not be able to install these types of tools. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the Makefile is a minor convenience mostly for installation. I could replace with an install.sh script |
||
|
||
SHELL := /bin/bash | ||
|
||
export PATH := ./bin:${PATH} | ||
|
||
all: install build test visualize | ||
|
||
install: | ||
hermit shell-hooks | ||
hermit install | ||
|
||
build: | ||
./gradlew build | ||
|
||
test: | ||
./gradlew check test | ||
|
||
visualize: | ||
gradle graphviz |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hermit |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Hermit environment | ||
|
||
This is a [Hermit](https://github.com/cashapp/hermit) bin directory. | ||
|
||
The symlinks in this directory are managed by Hermit and will automatically | ||
download and install Hermit itself as well as packages. These packages are | ||
local to this environment. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# This file must be used with "source bin/activate-hermit" from bash or zsh. | ||
# You cannot run it directly | ||
# | ||
# THIS FILE IS GENERATED; DO NOT MODIFY | ||
|
||
if [ "${BASH_SOURCE-}" = "$0" ]; then | ||
echo "You must source this script: \$ source $0" >&2 | ||
exit 33 | ||
fi | ||
|
||
BIN_DIR="$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")" | ||
if "${BIN_DIR}/hermit" noop > /dev/null; then | ||
eval "$("${BIN_DIR}/hermit" activate "${BIN_DIR}/..")" | ||
|
||
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ]; then | ||
hash -r 2>/dev/null | ||
fi | ||
|
||
echo "Hermit environment $("${HERMIT_ENV}"/bin/hermit env HERMIT_ENV) activated" | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.gradle-8.3.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
# | ||
# THIS FILE IS GENERATED; DO NOT MODIFY | ||
|
||
set -eo pipefail | ||
|
||
export HERMIT_USER_HOME=~ | ||
|
||
if [ -z "${HERMIT_STATE_DIR}" ]; then | ||
case "$(uname -s)" in | ||
Darwin) | ||
export HERMIT_STATE_DIR="${HERMIT_USER_HOME}/Library/Caches/hermit" | ||
;; | ||
Linux) | ||
export HERMIT_STATE_DIR="${XDG_CACHE_HOME:-${HERMIT_USER_HOME}/.cache}/hermit" | ||
;; | ||
esac | ||
fi | ||
|
||
export HERMIT_DIST_URL="${HERMIT_DIST_URL:-https://github.com/cashapp/hermit/releases/download/stable}" | ||
HERMIT_CHANNEL="$(basename "${HERMIT_DIST_URL}")" | ||
export HERMIT_CHANNEL | ||
export HERMIT_EXE=${HERMIT_EXE:-${HERMIT_STATE_DIR}/pkg/hermit@${HERMIT_CHANNEL}/hermit} | ||
|
||
if [ ! -x "${HERMIT_EXE}" ]; then | ||
echo "Bootstrapping ${HERMIT_EXE} from ${HERMIT_DIST_URL}" 1>&2 | ||
INSTALL_SCRIPT="$(mktemp)" | ||
# This value must match that of the install script | ||
INSTALL_SCRIPT_SHA256="180e997dd837f839a3072a5e2f558619b6d12555cd5452d3ab19d87720704e38" | ||
if [ "${INSTALL_SCRIPT_SHA256}" = "BYPASS" ]; then | ||
curl -fsSL "${HERMIT_DIST_URL}/install.sh" -o "${INSTALL_SCRIPT}" | ||
else | ||
# Install script is versioned by its sha256sum value | ||
curl -fsSL "${HERMIT_DIST_URL}/install-${INSTALL_SCRIPT_SHA256}.sh" -o "${INSTALL_SCRIPT}" | ||
# Verify install script's sha256sum | ||
openssl dgst -sha256 "${INSTALL_SCRIPT}" | \ | ||
awk -v EXPECTED="$INSTALL_SCRIPT_SHA256" \ | ||
'$2!=EXPECTED {print "Install script sha256 " $2 " does not match " EXPECTED; exit 1}' | ||
fi | ||
/bin/bash "${INSTALL_SCRIPT}" 1>&2 | ||
fi | ||
|
||
exec "${HERMIT_EXE}" --level=fatal exec "$0" -- "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.openjdk@17.pkg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal source code editor configuration files should not be a part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree. .editorconfig is intended to ensure any .editorconfig compliant editor (most modern editors/IDEs) comply to the standards used in the repo. otherwise you will spurious indent changes from contributors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synthea uses checkstyle for this purpose.