cf7c9f99 by Adam Heath

Add support for git submodules.

1 parent a8d7461a
# syntax=docker/dockerfile:1.4
# Builds a minimal docker image with openjdk and moqui with various volumes for configuration and persisted data outside the container
# NOTE: add components, build and if needed load data before building a docker image with this
ARG RUNTIME_IMAGE=eclipse-temurin:11-jdk
......@@ -5,7 +6,7 @@ FROM ${RUNTIME_IMAGE} AS moqui-base
RUN true \
&& apt-get update \
&& apt-get install -y unzip less \
&& apt-get install -y unzip less git \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& groupadd -g 1000 moqui \
&& useradd -u 1000 -g 1000 -G 0 -d /opt/moqui moqui \
......@@ -27,9 +28,18 @@ FROM moqui-base AS moqui-build
WORKDIR /opt/moqui-build
COPY framework/ ./
COPY runtime/ runtime/
COPY component/ runtime/component/
RUN ["mkdir", "/opt/moqui-scripts"]
COPY --from=moqui-builder fix-git-submodules /opt/moqui-scripts/fix-git-submodules
COPY ./ /opt/moqui-app/
RUN ["/opt/moqui-scripts/fix-git-submodules", "-start", "/opt/moqui-app"]
RUN true && set -x \
&& rm -rf /opt/moqui-build && ln -sf /opt/moqui-app/framework /opt/moqui-build \
&& rm -rf /opt/moqui-build/runtime && ln -sf /opt/moqui-app/runtime /opt/moqui-build/runtime \
&& rm -rf /opt/moqui-build/runtime/component && ln -sf /opt/moqui-app/component /opt/moqui-build/runtime/component \
&& true
RUN ["./gradlew", "--no-daemon", "--info", "build", "addRuntime"]
......
#!/bin/bash
set -e
TAG=test-latest
APP=moqui-app
PUSH_TO=docker://5.161.91.120:31234
PREFIX=
declare -a images=(moqui-jdbc-drivers moqui-app)
TOP_DIR="$(cd "$(dirname "$0")"; pwd -P)"
_build() {
for image in "${images[@]}"; do
docker build -f Dockerfile --tag "${PREFIX}${image}:${TAG}" --target "${image}" "${APP}"
docker buildx build --progress plain --build-context "moqui-builder=$TOP_DIR" -f "${TOP_DIR}/Dockerfile" --tag "${PREFIX}${image}:${TAG}" --target "${image}" "${APP}"
done
}
......
#!/bin/bash
set -ex
cmd="$1"
shift
case "$cmd" in
(-start)
dir="$1"
shift
find "$dir" -type f -name '.git' -exec "$0" -fix "$dir" '{}' \;
;;
(-fix)
dir="$1"
gitdir_link="$2"
gitdir_dir="$(dirname "$gitdir_link")"
read gitdir_token gitdir_location < "$gitdir_link"
case "$gitdir_location" in
(/*)
echo "Can't handle absolute gitdir location: $gitdir_location" 1>&2
exit 1
;;
esac
cd "$gitdir_dir"
pushd "$gitdir_location"
git config --unset core.worktree
popd
rm .git
mv "$gitdir_location" .git
;;
esac