Skip to content

Commit

Permalink
Add cmake image
Browse files Browse the repository at this point in the history
  • Loading branch information
danielk43 committed Dec 18, 2024
1 parent 0fe590d commit abe6de1
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 10 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
pull_request:
schedule:
- cron: '0 0 * * 5'
- cron: '5 3 * * Sat'

env:
REGISTRY: docker.io
Expand Down Expand Up @@ -32,22 +32,38 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# Extract metadata (tags, labels) for Docker android build
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
- name: Extract Docker metadata android
id: meta-android
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}_android
tags: |
type=raw,value=latest,enable=true
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
- name: Build and push Docker image android
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355
with:
context: .
context: android
push: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/pull') && github.actor != 'dependabot[bot]' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta-android.outputs.tags }}
labels: ${{ steps.meta-android.outputs.labels }}

- name: Extract Docker metadata cmake
id: meta-cmake
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}_cmake
tags: |
type=raw,value=latest,enable=true
- name: Build and push Docker image cmake
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355
with:
context: cmake
push: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/pull') && github.actor != 'dependabot[bot]' }}
tags: ${{ steps.meta-cmake.outputs.tags }}
labels: ${{ steps.meta-cmake.outputs.labels }}
1 change: 1 addition & 0 deletions Dockerfile → android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ RUN mkdir bin \
&& rm -rf /var/cache/apt/* \
&& npm install --global --upgrade yarn \
&& npm cache clean --force \
&& echo 'alias ll="ls -alF"' >> /root/.bashrc \
&& ln -sf /proc/1/fd/1 /var/log/docker.log

COPY --chmod=0755 build_android.sh build_android.sh
Expand Down
5 changes: 4 additions & 1 deletion build_android.sh → android/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ repo_safe_dir() {
# Allow existing repo to work in container (will change some ownership to root)
git config --global --add safe.directory "${PWD}/.repo/manifests"
git config --global --add safe.directory "${PWD}/.repo/repo"
for path in $(repo list -fp); do git config --global --add safe.directory "${path}"; done
if repo list 2>/dev/null
then
for path in $(repo list -fp); do git config --global --add safe.directory "${path}"; done
fi
}

clean_repo() {
Expand Down
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions cmake/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM debian:bookworm-slim

ARG DEBIAN_FRONTEND=noninteractive

WORKDIR /cmake_build

RUN mkdir -p bin \
&& apt update \
&& apt -y upgrade \
&& apt -y install curl \
&& curl -L https://apt.llvm.org/llvm-snapshot.gpg.key -o /usr/share/keyrings/llvm-snapshot.gpg.key \
&& echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] https://apt.llvm.org/bookworm/\
llvm-toolchain-bookworm-18 main" | tee -a /etc/apt/sources.list.d/llvm.list \
&& echo 'alias ll="ls -alF"' >> /root/.bashrc \
&& apt update \
&& apt install -y autoconf autoconf-archive automake build-essential ccache \
clang-18 clangd-18 clang-format-18 clang-tidy-18 fonts-liberation2 \
git-core libgl1-mesa-dev libpulse-dev libssl-dev lld-18 nasm pkg-config \
qt6-base-dev qt6-tools-dev-tools qt6-wayland tar unzip zip \
&& curl -LO $(curl -s https://api.github.com/repos/ninja-build/ninja/releases/latest \
| grep "browser_download_url.*linux.zip" | cut -d\" -f4) \
&& unzip ninja-linux.zip -d /usr/local/bin \
&& git clone https://github.com/Kitware/CMake.git \
&& cd CMake && ./bootstrap && make && make install && cd - >/dev/null \
&& apt -y autoremove \
&& apt autoclean \
&& rm -rf /var/cache/apt/* CMake *.zip \
&& ln -sf /proc/1/fd/1 /var/log/docker.log

0 comments on commit abe6de1

Please sign in to comment.