Skip to content

Commit 944208e

Browse files
committed
Add docker build in tree
Adds docker build and configure-from-env script to configure OIE server based on environment variables at container startup time. Issue: #40 Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
1 parent cccc181 commit 944208e

File tree

5 files changed

+438
-0
lines changed

5 files changed

+438
-0
lines changed

.dockerignore

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Include any files or directories that you don't want to be copied to your
2+
# container here (e.g., local build artifacts, temporary files, etc.).
3+
#
4+
# For more help, visit the .dockerignore file reference guide at
5+
# https://docs.docker.com/go/build-context-dockerignore/
6+
7+
**/.DS_Store
8+
**/.classpath
9+
**/.dockerignore
10+
**/.env
11+
**/.factorypath
12+
**/.git
13+
**/.gitignore
14+
**/.idea
15+
**/.project
16+
**/.sts4-cache
17+
**/.settings
18+
**/.toolstarget
19+
**/.vs
20+
**/.vscode
21+
**/.next
22+
**/.cache
23+
**/*.dbmdl
24+
**/*.jfm
25+
**/charts
26+
**/docker-compose*
27+
**/compose.y*ml
28+
**/Dockerfile*
29+
**/secrets.dev.yaml
30+
**/values.dev.yaml
31+
**/vendor
32+
LICENSE
33+
README.md
34+
**/*.class
35+
**/*.iml
36+
**/*.ipr
37+
**/*.iws
38+
**/*.log
39+
**/.apt_generated
40+
**/.gradle
41+
**/.gradletasknamecache
42+
**/.nb-gradle
43+
**/.springBeans
44+
**/build
45+
**/dist
46+
**/gradle-app.setting
47+
**/nbbuild
48+
**/nbdist
49+
**/nbproject/private
50+
**/target
51+
*.ctxt
52+
.mtj.tmp
53+
.mvn/timing.properties
54+
buildNumber.properties
55+
dependency-reduced-pom.xml
56+
hs_err_pid*
57+
pom.xml.next
58+
pom.xml.releaseBackup
59+
pom.xml.tag
60+
pom.xml.versionsBackup
61+
release.properties
62+
replay_pid*

DEVELOPERS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# For developers and contributors
2+
3+
## Build and run locally
4+
5+
To build the solution, you must have a Java 1.8 JDK+FX and Apache Ant. This
6+
can be installed by [sdkman](https://sdkman.io/) by executing `sdk env install`.
7+
From the `server/` directory, run `ant -f mirth-build.xml -DdisableSigning=true`.
8+
9+
After build, run the server by invoking `server/setup/oieserver` in bash.
10+
11+
## Build and run with docker
12+
13+
```bash
14+
# Build using docker
15+
docker build -t oie-dev .
16+
# Start an ephemeral image
17+
# NOTE: All data will be deleted on stop due to --rm. Use a volume for "real" use.
18+
docker run --rm -p 8443:8443 oie-dev
19+
```
20+
21+
## Connect
22+
23+
Then use [Ballista](https://github.com/kayyagari/ballista) to connect to
24+
https://localhost:8443/ and login using admin admin.
25+
26+
If you are using Mirth Connect Administrator Launcher, you may need to omit
27+
`-DdisableSigning=true` to support JWS signatures and run MCAL passing `-k -d`
28+
to make it ignore self-signed certificates. Launchers like
29+
[Ballista](https://github.com/kayyagari/ballista) do not require signing, and
30+
signing adds considerable time to the build process.

Dockerfile

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# syntax=docker/dockerfile:1
2+
3+
# Stages:
4+
# 1. Builder Stage: Compiles the application and resolves dependencies. Produces
5+
# JAR files that can be deployed.
6+
# 1a. Install dependencies
7+
# 1b. Build the application
8+
# 2. Runner Stage: Creates a lightweight image that runs the application using the JRE.
9+
10+
FROM ubuntu:noble-20251013 AS builder
11+
WORKDIR /app
12+
# sdkman requires bash
13+
SHELL ["/bin/bash", "-c"]
14+
15+
# Stage 1a: Install dependencies
16+
# Install necessary tools
17+
COPY .sdkmanrc .
18+
RUN apt-get update\
19+
&& apt-get install -y zip curl\
20+
&& curl -s "https://get.sdkman.io?ci=true" | bash \
21+
&& source "$HOME/.sdkman/bin/sdkman-init.sh" && sdk env install \
22+
&& rm -rf /var/lib/apt/lists/*
23+
24+
# Stage 1b: Build the application
25+
# Copy the entire source tree (excluding .dockerignore files), and build
26+
COPY --exclude=docker . .
27+
WORKDIR /app/server
28+
RUN source "$HOME/.sdkman/bin/sdkman-init.sh" \
29+
&& ANT_OPTS="-Dfile.encoding=UTF8" ant -f mirth-build.xml -DdisableSigning=true
30+
31+
##########################################
32+
#
33+
# Ubuntu JDK Image
34+
#
35+
##########################################
36+
37+
FROM eclipse-temurin:21.0.9_10-jdk-noble AS jdk-run
38+
39+
RUN groupadd engine \
40+
&& usermod -l engine ubuntu \
41+
&& adduser engine engine \
42+
&& mkdir -p /opt/engine/appdata \
43+
&& chown -R engine:engine /opt/engine
44+
45+
WORKDIR /opt/engine
46+
COPY --chown=engine:engine --from=builder \
47+
--exclude=cli-lib \
48+
--exclude=mirth-cli-launcher.jar \
49+
--exclude=mccommand \
50+
--exclude=manager-lib \
51+
--exclude=mirth-manager-launcher.jar \
52+
--exclude=mcmanager \
53+
/app/server/setup ./
54+
55+
VOLUME /opt/engine/appdata
56+
VOLUME /opt/engine/custom-extensions
57+
EXPOSE 8443
58+
59+
USER engine
60+
ENTRYPOINT ["./configure-from-env.sh"]
61+
CMD ["./oieserver"]
62+
63+
##########################################
64+
#
65+
# Alpine JRE Image
66+
#
67+
##########################################
68+
69+
FROM eclipse-temurin:21.0.9_10-jre-alpine AS jre-run
70+
71+
# Alpine does not include bash by default, so we install it
72+
RUN apk add --no-cache bash
73+
# useradd and groupadd are not available in Alpine
74+
RUN addgroup -S engine \
75+
&& adduser -S -g engine engine \
76+
&& mkdir -p /opt/engine/appdata \
77+
&& chown -R engine:engine /opt/engine
78+
79+
WORKDIR /opt/engine
80+
COPY --chown=engine:engine --from=builder \
81+
--exclude=cli-lib \
82+
--exclude=mirth-cli-launcher.jar \
83+
--exclude=mccommand \
84+
--exclude=manager-lib \
85+
--exclude=mirth-manager-launcher.jar \
86+
--exclude=mcmanager \
87+
/app/server/setup ./
88+
89+
VOLUME /opt/engine/appdata
90+
VOLUME /opt/engine/custom-extensions
91+
92+
EXPOSE 8443
93+
94+
USER engine
95+
ENTRYPOINT ["./configure-from-env"]
96+
CMD ["./oieserver"]

0 commit comments

Comments
 (0)