-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add docker images for building the different platforms #11397
Open
ermshiperete
wants to merge
19
commits into
master
Choose a base branch
from
chore/linux/cicontainer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9c7e2c8
change(common): preliminary update of min node version
ermshiperete 2dffec3
docs(common): improve formatting of `builder.md`
ermshiperete d554415
change(common): add readme and `build.sh`
ermshiperete 5c337be
feat(common): add base CI image
ermshiperete 72bc6c7
feat(linux): add CI image for building Keyman for Linux
ermshiperete 2767765
feat(web): add CI image for building Keyman Web
ermshiperete 23d8a01
feat(android): add CI image for building Keyman for Android
ermshiperete 8a4cdce
feat(core): add CI image for building Keyman Core
ermshiperete 1ad55b1
Merge branch 'master' into chore/linux/cicontainer
mcdurdin ad4bbdf
feat(common): add script to run build and tests in Docker container
ermshiperete cc5fef0
Merge branch 'master' into chore/linux/cicontainer
ermshiperete d6c5320
chore(linux): address code review comments
ermshiperete 1772fdf
chore(linux): pre-install EMSCRIPTEN
ermshiperete 6b34c5c
Merge branch 'master' into chore/linux/cicontainer
ermshiperete 0d6f655
chore(linux): fix build order
ermshiperete 475fd73
docs(android): document gradle version in `minimum-versions`
ermshiperete caba09a
chore(linux): attempt to fix Android build in Docker
ermshiperete e23e112
chore(linux): remove temporary code for Core image
ermshiperete e54f822
chore(linux): cleanup
ermshiperete File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Container | ||
|
||
Docker containers that can be used to build Keyman on the respective | ||
platforms. They contain everything that a CI build agent needs to | ||
build for the platform. | ||
|
||
## Prerequisites | ||
|
||
You'll need Docker Buildx installed to successfully be able to build the | ||
container images. This is most easily achieved by installing the [official | ||
Docker version](https://docs.docker.com/engine/install/ubuntu/). | ||
|
||
Currently it is not possible to use Podman instead of Docker due to a number | ||
of bugs and incompatibilities in the Podman implementation. | ||
|
||
## Building the images | ||
|
||
To build the docker images: | ||
|
||
```shell | ||
resources/docker-images/build.sh | ||
``` | ||
|
||
By default this will create 64-bit images for building | ||
Keyman Core, Keyman for Android, Keyman for Linux and | ||
Keyman for Web. These images are based on the Ubuntu 24.04 | ||
with Node 20 and Emscripten 3.1.58 (for the exact versions, | ||
see [`minimum-versions.inc.sh`](../build/minimum-versions.inc.sh)) | ||
and are named e.g. `keyman-core-ci:default`. | ||
|
||
The versions can be changed, e.g. | ||
|
||
```shell | ||
resources/docker-images/build.sh --ubuntu-version jammy --node 20 | ||
``` | ||
|
||
This will create an image named e.g. `keyman-core-ci:jammy-node20`. | ||
|
||
Once the image is built, it may be used to build parts of Keyman. | ||
|
||
## Building locally | ||
|
||
It is possible to build locally with these images: | ||
|
||
```shell | ||
# build 'Keyman Core' in docker | ||
resources/docker-images/run.sh core -- core/build.sh --debug build | ||
``` | ||
|
||
Note: For Core and Linux we put the generated binaries in a | ||
container specific directory because they are platform dependent. | ||
|
||
If you build both with Docker and directly with the build scripts, it is | ||
advisable to run a `git clean -dxf` before switching between the two. The | ||
reason is that the Docker images use a different user, so that paths | ||
will be different. | ||
|
||
## Running tests locally | ||
|
||
To run the tests locally, use the `run.sh` script: | ||
|
||
```shell | ||
# Run common/web tests | ||
resources/docker-images/run.sh web -- common/web/build.sh --debug test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Copyright (c) 2024 SIL International. All rights reserved. | ||
|
||
ARG BASE_VERSION=default | ||
FROM keymanapp/keyman-base-ci:${BASE_VERSION} | ||
LABEL org.opencontainers.image.authors="SIL International." | ||
LABEL org.opencontainers.image.url="https://github.com/keymanapp/keyman.git" | ||
LABEL org.opencontainers.image.title="Keyman Android Build Image" | ||
|
||
# Keyman for Android | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
# Starting with Ubuntu 24.04 sdkmanager is no longer available, instead | ||
# a version dependent package allows to install the cmdline tools | ||
ARG JAVA_VERSION=11 | ||
RUN <<EOF | ||
OS_VER=$(lsb_release -r -s 2>/dev/null) | ||
echo "OS_VER=${OS_VER}" | ||
if (( ${OS_VER%%.*} > 22 )); then | ||
PKG_SDKMANAGER=google-android-cmdline-tools-13.0-installer | ||
DIR_SDK=/usr/lib/android-sdk | ||
else | ||
PKG_SDKMANAGER=sdkmanager | ||
DIR_SDK=/opt/android-sdk | ||
fi | ||
apt-get -q -y install gradle maven pandoc $PKG_SDKMANAGER jq openjdk-${JAVA_VERSION}-jdk | ||
sdkmanager platform-tools | ||
yes | sdkmanager --licenses | ||
chown -R build:build $DIR_SDK | ||
echo "export ANDROID_HOME=$DIR_SDK" >> /usr/bin/bashwrapper | ||
echo "export JAVA_HOME_${JAVA_VERSION}=/usr/lib/jvm/java-${JAVA_VERSION}-openjdk-amd64" >> /usr/bin/bashwrapper | ||
EOF | ||
|
||
# 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 | ||
|
||
# Pre-install gradle. This will put files in ~/.gradle which will speed up builds. | ||
RUN mkdir -p $HOME/tmp/gradle/wrapper && \ | ||
# KMEA uses gradle-7.6.4-bin | ||
curl --location --output $HOME/tmp/gradle/wrapper/gradle-wrapper.jar https://raw.githubusercontent.com/keymanapp/keyman/master/android/KMEA/gradle/wrapper/gradle-wrapper.jar && \ | ||
curl --location --output $HOME/tmp/gradle/wrapper/gradle-wrapper.properties https://raw.githubusercontent.com/keymanapp/keyman/master/android/KMEA/gradle/wrapper/gradle-wrapper.properties && \ | ||
curl --location --output $HOME/tmp/gradlew https://raw.githubusercontent.com/keymanapp/keyman/master/android/KMEA/gradlew && \ | ||
chmod +x $HOME/tmp/gradlew && \ | ||
$HOME/tmp/gradlew --quiet && \ | ||
# Some projects use gradle-7.6.4-all, so we pre-install that as well | ||
curl --location --output $HOME/tmp/gradle/wrapper/gradle-wrapper.jar https://raw.githubusercontent.com/keymanapp/keyman/master/android/Samples/KMSample1/gradle/wrapper/gradle-wrapper.jar && \ | ||
curl --location --output $HOME/tmp/gradle/wrapper/gradle-wrapper.properties https://raw.githubusercontent.com/keymanapp/keyman/master/android/Samples/KMSample1/gradle/wrapper/gradle-wrapper.properties && \ | ||
curl --location --output $HOME/tmp/gradlew https://raw.githubusercontent.com/keymanapp/keyman/master/android/Samples/KMSample1/gradlew && \ | ||
chmod +x $HOME/tmp/gradlew && \ | ||
$HOME/tmp/gradlew --quiet && \ | ||
rm -rf $HOME/tmp | ||
|
||
ENTRYPOINT [ "/usr/bin/bashwrapper" ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the Dockerfiles below use Node 18?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's just the default value that doesn't get used. The node version get's passed in. I had to put something here, so I choose a somewhat sensible value that is different from what we currently have so that it's easier noticable if passing the value doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be node 20 -- I think the req shifted since this PR started