Skip to content

Commit 37d46c7

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 37d46c7

5 files changed

Lines changed: 442 additions & 0 deletions

File tree

.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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# For developers and contributors
2+
3+
You can build and run OIE locally, or using Docker. For full documentation see [docs.openintegrationengine.org](https://docs.openintegrationengine.org/engine/contributing.html).
4+
5+
## Local Build and Run
6+
7+
```bash
8+
# Install dependencies manually or use https://sdkman.io/
9+
sdk env install
10+
11+
# Build the server
12+
# NOTE: Building will delete any existing server configuration!
13+
ant -f server/mirth-build.xml -DdisableSigning=true
14+
15+
# Run the server
16+
server/setup/oieserver
17+
18+
# Connect using Ballista or another launcher at https://localhost:8443
19+
```
20+
21+
## Or Using Docker
22+
23+
```bash
24+
# Build using docker
25+
docker build -t oie-dev .
26+
27+
# Start an ephemeral image
28+
# NOTE: All data will be deleted on stop due to --rm. Use a volume for "real" use.
29+
docker run --rm -p 8443:8443 oie-dev
30+
31+
# Connect using Ballista or another launcher at https://localhost:8443
32+
```

Dockerfile

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

0 commit comments

Comments
 (0)