Skip to content

Commit 1491a35

Browse files
committed
Added docker build and quick-start (without entrypoint and oieserver scripts)
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
1 parent 8e6a11e commit 1491a35

File tree

3 files changed

+180
-0
lines changed

3 files changed

+180
-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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# For developers and contributors
2+
3+
## "Easy Path" with docker
4+
5+
```bash
6+
# Build using docker
7+
docker build -t oie-dev .
8+
# Start an ephemeral image
9+
# NOTE: All data will be deleted on stop due to --rm. Use a volume for "real" use.
10+
docker run --rm -p 8443:8443 oie-dev
11+
```
12+
13+
Then use [Ballista](https://github.com/kayyagari/ballista) to connect to
14+
https://localhost:8443/ and login using admin admin.
15+
16+
## Build Environment
17+
18+
To build the solution, you must have a Java 1.8 JDK+FX and Apache Ant. This
19+
can be installed by [sdkman](https://sdkman.io/) by executing `sdkman env install`.
20+
21+
## Build Process
22+
23+
From the `server/` directory, run `ant -f mirth-build.xml -DdisableSigning=true`.
24+
25+
If you are using Mirth Connect Administrator Launcher, you may need to omit
26+
`-DdisableSigning=true` to support JWS signatures. Launchers like
27+
[Ballista](https://github.com/kayyagari/ballista) do not require signing, and
28+
signing adds considerable time to the build process.
29+
30+
## Run
31+
32+
After build, run the server by invoking `server/mirth-server-launcher.jar`. An
33+
example of how to do this is listed in `docker/mirth-connect.sh`.

Dockerfile

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# syntax=docker/dockerfile:1.7-labs
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-20250415.1 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+
# Stage 2b: JDK runtime container
32+
FROM eclipse-temurin:21.0.7_6-jdk-noble as jdk-run
33+
34+
RUN groupadd mirth \
35+
&& usermod -l mirth ubuntu \
36+
&& adduser mirth mirth \
37+
&& mkdir -p /opt/connect/appdata \
38+
&& chown -R mirth:mirth /opt/connect
39+
40+
WORKDIR /opt/connect
41+
COPY --chown=mirth:mirth --from=builder \
42+
--exclude=cli-lib \
43+
--exclude=mirth-cli-launcher.jar \
44+
--exclude=mccommand \
45+
--exclude=manager-lib \
46+
--exclude=mirth-manager-launcher.jar \
47+
--exclude=mcmanager \
48+
/app/server/setup ./
49+
50+
VOLUME /opt/connect/appdata
51+
VOLUME /opt/connect/custom-extensions
52+
EXPOSE 8443
53+
54+
USER mirth
55+
ENTRYPOINT [ "/opt/connect/entrypoint.sh" ]
56+
CMD ["/opt/connect/mirth-connect.sh"]
57+
58+
# Stage 2b: JRE runtime container
59+
FROM eclipse-temurin:21.0.7_6-jre-alpine as jre-run
60+
61+
# Alpine does not include bash by default, so we install it
62+
RUN apk add --no-cache bash
63+
# useradd and groupadd are not available in Alpine
64+
RUN addgroup -S mirth \
65+
&& adduser -S -g mirth mirth \
66+
&& mkdir -p /opt/connect/appdata \
67+
&& chown -R mirth:mirth /opt/connect
68+
69+
WORKDIR /opt/connect
70+
COPY --chown=mirth:mirth --from=builder \
71+
--exclude=cli-lib \
72+
--exclude=mirth-cli-launcher.jar \
73+
--exclude=mccommand \
74+
--exclude=manager-lib \
75+
--exclude=mirth-manager-launcher.jar \
76+
--exclude=mcmanager \
77+
/app/server/setup ./
78+
79+
VOLUME /opt/connect/appdata
80+
VOLUME /opt/connect/custom-extensions
81+
EXPOSE 8443
82+
83+
USER mirth
84+
ENTRYPOINT [ "/opt/connect/entrypoint.sh" ]
85+
CMD ["/opt/connect/mirth-connect.sh"]

0 commit comments

Comments
 (0)