mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-06 17:05:34 +00:00
This change verifies that `docker buildx` is available and then uses that for building the images. For that we apparently need the magic line at the top of the `Dockerfile`s and set the environment variable `DOCKER_BUILDKIT`. This solves a problem building docker images on Linux with an older Docker version where the heredocs didn't work.
57 lines
1.9 KiB
Docker
57 lines
1.9 KiB
Docker
# syntax=docker/dockerfile:1.4
|
|
# Keyman is copyright (C) SIL Global. MIT License.
|
|
|
|
ARG BASE_VERSION=default
|
|
FROM keymanapp/keyman-base-ci:${BASE_VERSION}
|
|
LABEL org.opencontainers.image.authors="SIL Global."
|
|
LABEL org.opencontainers.image.url="https://github.com/keymanapp/keyman.git"
|
|
LABEL org.opencontainers.image.title="Keyman Linux Build Image"
|
|
|
|
# Install dependencies
|
|
ADD control /tmp/control
|
|
# Answer 'yes' to install questions
|
|
RUN apt-get update && \
|
|
apt-get install -qy python3 python3-setuptools python3-coverage \
|
|
devscripts equivs libdatetime-perl lcov gcovr xvfb \
|
|
xserver-xephyr metacity mutter dbus-x11 weston xwayland && \
|
|
(yes | mk-build-deps --install /tmp/control) || true && \
|
|
rm /tmp/control
|
|
|
|
# Install lcov for code coverage
|
|
# Update to the latest and install packages needed for Linux coverage reporting
|
|
# and integration tests. We need at least version 2.0 of lcov. However,
|
|
# version 2.0-4 from Noble doesn't work either on Jammy. So we use
|
|
# version 2.0-1 from Mantic.
|
|
RUN LCOV_VERSION=$(dpkg -s lcov | grep Version | cut -d' ' -f2) && \
|
|
if dpkg --compare-versions "${LCOV_VERSION}" lt 2.0; then \
|
|
curl -sS -o /tmp/lcov.deb --location https://old-releases.ubuntu.com/ubuntu/pool/universe/l/lcov/lcov_2.0-1ubuntu0.2_all.deb && \
|
|
apt-get -qy install /tmp/lcov.deb && \
|
|
rm /tmp/lcov.deb ; \
|
|
fi
|
|
|
|
RUN mkdir -p /run/user/1000 && \
|
|
chown build:build /run/user/1000 && \
|
|
chmod 700 /run/user/1000 && \
|
|
mkdir -p /tmp/.X11-unix && \
|
|
chmod 1777 /tmp/.X11-unix && \
|
|
echo "export XDG_RUNTIME_DIR=/run/user/1000" >> /usr/bin/bashwrapper
|
|
|
|
COPY run-tests.sh /usr/bin/run-tests.sh
|
|
|
|
# Finish bashwrapper script and adjust permissions
|
|
RUN <<EOF cat >> /usr/bin/bashwrapper
|
|
|
|
if [[ "\$@" =~ test ]] && [ -f /usr/bin/run-tests.sh ]; then
|
|
/usr/bin/run-tests.sh "\${@:-bash}"
|
|
else
|
|
"\${@:-bash}"
|
|
fi
|
|
EOF
|
|
|
|
# now, switch to build user
|
|
USER build
|
|
|
|
VOLUME /home/build/build
|
|
WORKDIR /home/build/build
|
|
|
|
ENTRYPOINT [ "/usr/bin/bashwrapper" ]
|