-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(tiledit): use a docker image to build
- Loading branch information
1 parent
a888410
commit 69046e5
Showing
5 changed files
with
117 additions
and
28 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Build Docker image | ||
|
||
# Based on https://github.com/Delgan/qml-format/blob/a57ccf9991ca3e210d2ec3c97156c5fb4bb66227/.github/workflows/docker.yml (Thanks!) | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}-tiledit-build | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: sirc-tiledit/docker/builder.Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,29 @@ | ||
# Builder Dockerfile | ||
|
||
It was annoying to get a consistent environment to build the project in since | ||
it is currently being developed on Fedora Linux and MacOS and built on Ubuntu. | ||
|
||
This should be the source of truth for the build environment and used as a reference for versions etc. | ||
|
||
# Usage | ||
|
||
## Building it | ||
|
||
From this directory: | ||
|
||
```shell | ||
docker build -t sirc:tiledit-builder -f ./builder.Dockerfile . | ||
``` | ||
|
||
## Using it | ||
|
||
From this directory: | ||
|
||
```shell | ||
podman run --rm -v"$(pwd)/..":/project:z sirc:tiledit-builder meson compile | ||
podman run --rm -v"$(pwd)/..":/project:z sirc:tiledit-builder meson 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,34 @@ | ||
LABEL version="1.0" | ||
LABEL maintainer="Sean Dawson <contact@seandawson.info>" | ||
LABEL description="This image is used as a consistent environment to build the C++/qt6 based tiledit component of the SIRC project." | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
FROM docker.io/library/ubuntu:noble | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y pkg-config libpng-dev qt6-base-dev meson ninja-build gcovr wget software-properties-common && \ | ||
wget https://apt.llvm.org/llvm.sh -P /tmp && \ | ||
chmod +x /tmp/llvm.sh && \ | ||
/tmp/llvm.sh 18 all && \ | ||
# TODO: Surely there is an easier way to set default version | ||
ln -s $(which clang-tidy-18) /usr/local/bin/clang-tidy && \ | ||
ln -s $(which clang-format-18) /usr/local/bin/clang-format && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
ENV CC=clang-18 | ||
ENV CXX=clang++-18 | ||
|
||
RUN groupadd -g 10001 builder && \ | ||
useradd -u 10000 -g builder builder && \ | ||
mkdir /builder && \ | ||
chown -R builder:builder /builder | ||
|
||
COPY ./entrypoint.sh /builder/ | ||
|
||
WORKDIR /project | ||
|
||
USER builder:builder | ||
|
||
ENTRYPOINT ["/builder/entrypoint.sh"] |
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,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd /project | ||
meson setup /builder/build | ||
|
||
cd /builder/build | ||
"$@" |