Skip to content

Commit 38f09bd

Browse files
authored
Merge pull request #177 from mendix/DES-5253_fix-builds
DES-5253 Fix builds
2 parents 3a91cde + 48ac3d5 commit 38f09bd

File tree

5 files changed

+40
-8
lines changed

5 files changed

+40
-8
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
The Mendix Buildpack for Docker (aka docker-mendix-buildpack) is an **example project** you can use to build and run your Mendix Application in a [Docker](https://www.docker.com/) container.
66

7-
**⚠️ Warning** At this time, Docker Buildpack doesn't support building Mendix 10 MPK files. To deploy a Mendix 10 app with Docker Buildpack, you will need to build the MDA file first (using Studio Pro 10 or [MxBuild](https://docs.mendix.com/refguide/mxbuild/)), and deploy the MDA file using Docker Buildpack.
8-
97
**⚠️ Warning** If your pipeline is based on Docker Buildpack V4 or an earlier version, see the [upgrading from Docker Buildpack v4](upgrading-from-v4.md) document. To use Docker Buildpack v5, some changes will be required in your build process.
108

119
For a Kubernetes native solution to run Mendix apps, see [Mendix for Private Cloud](https://www.mendix.com/evaluation-guide/app-lifecycle/mendix-for-private-cloud/).

rootfs-app.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ENV LC_ALL C.UTF-8
1212
# install dependencies & remove package lists
1313
RUN microdnf update -y && \
1414
microdnf module enable nginx:1.20 -y && \
15-
microdnf install -y glibc-langpack-en python311 openssl nginx nginx-mod-stream java-11-openjdk-headless fontconfig && \
15+
microdnf install -y glibc-langpack-en python311 openssl nginx nginx-mod-stream java-11-openjdk-headless tzdata-java fontconfig && \
1616
microdnf clean all && rm -rf /var/cache/yum
1717

1818
# Set nginx permissions

rootfs-builder.dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ENV LANG C.UTF-8
1010
ENV LC_ALL C.UTF-8
1111

1212
# CF buildpack version
13-
ARG CF_BUILDPACK=v5.0.0
13+
ARG CF_BUILDPACK=v5.0.4
1414
# CF buildpack download URL
1515
ARG CF_BUILDPACK_URL=https://github.com/mendix/cf-mendix-buildpack/releases/download/${CF_BUILDPACK}/cf-mendix-buildpack.zip
1616

@@ -33,7 +33,7 @@ RUN rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.
3333
microdnf clean all && rm -rf /var/cache/yum
3434

3535
# Install RHEL alternatives to CF Buildpack dependencies
36-
RUN microdnf install -y java-11-openjdk-headless java-11-openjdk-devel mono-core-5.20.1.34 libgdiplus0 libicu && \
36+
RUN microdnf install -y java-11-openjdk-headless java-11-openjdk-devel tzdata-java mono-core-5.20.1.34 libgdiplus0 libicu && \
3737
microdnf clean all && rm -rf /var/cache/yum
3838

3939
# Set nginx permissions
@@ -69,7 +69,7 @@ RUN mkdir -p /opt/mendix/buildpack /opt/mendix/build &&\
6969
chmod -R g=u /opt/mendix
7070

7171
# Copy python scripts which execute the buildpack (exporting the VCAP variables)
72-
COPY scripts/compilation.py scripts/git /opt/mendix/buildpack/
72+
COPY scripts/compilation.py scripts/git scripts/mono-adapter /opt/mendix/buildpack/
7373

7474
# Install the buildpack Python dependencies
7575
RUN PYTHON_BUILD_RPMS="python3.11-pip python3.11-devel libffi-devel gcc" && \

scripts/compilation.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,22 @@ def export_vcap_services():
3434
def replace_cf_dependencies():
3535
logging.debug("Ensuring CF Buildpack dependencies are available")
3636

37+
mx_version = runtime.get_runtime_version("/opt/mendix/build")
38+
logging.debug("Detected Mendix version {0}".format(mx_version))
39+
3740
# Only mono 5 is supported by Docker Buildpack
3841
mono_dependency = get_dependency("mono.5-jammy", "/opt/mendix/buildpack")
3942
logging.debug("Creating symlink for mono {0}".format(mono_dependency['artifact']))
4043

4144
util.mkdir_p("/tmp/buildcache/bust")
4245
mono_cache_artifact = f"/tmp/buildcache/bust/mono-{mono_dependency['version']}-mx-ubuntu-jammy.tar.gz"
4346
with tarfile.open(mono_cache_artifact, "w:gz") as tar:
44-
# Symlinks to use mono from host OS
45-
symlinks = {'mono/bin':'/usr/bin', 'mono/lib': '/usr/lib64', 'mono/etc': '/etc'}
47+
if mx_version.major >= 10:
48+
# Mono is not needed for Mendix 10, use the bash adapter script
49+
symlinks = {'mono/bin/mono':'/opt/mendix/buildpack/mono-adapter', 'mono/lib': '/usr/lib64'}
50+
else:
51+
# Symlinks to use mono from host OS
52+
symlinks = {'mono/bin':'/usr/bin', 'mono/lib': '/usr/lib64', 'mono/etc': '/etc'}
4653
for source, destination in symlinks.items():
4754
symlink = tarfile.TarInfo(source)
4855
symlink.type = tarfile.SYMTYPE

scripts/mono-adapter

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
# This script works as a drop-in replacement for mono and allows using non-mono mxbuild in CF Buildpack.
4+
# It's a temporary workaround until https://github.com/mendix/cf-mendix-buildpack/pull/661 is available in CF Buildpack v5.
5+
6+
MONO_ARGS=()
7+
# Rewrite the command to exclude mono and its args, only keep mxbuild
8+
while [[ $# -gt 0 ]]; do
9+
case $1 in
10+
*mxbuild.exe)
11+
# Remove .exe from mxbuild executable name
12+
MONO_ARGS=(${1%.*})
13+
shift
14+
;;
15+
*)
16+
# Keep all args after mxbuild
17+
if [ -n "$MONO_ARGS" ]; then
18+
MONO_ARGS+=("$1")
19+
fi
20+
shift
21+
;;
22+
esac
23+
done
24+
25+
echo "Launching MxBuild through mono adapter..."
26+
27+
exec "${MONO_ARGS[@]}"

0 commit comments

Comments
 (0)