Skip to content

Commit 9b1fcb9

Browse files
committed
Build dockers
I added a new Docker image for Ubuntu 24.04 and updated the others. I also created two new workflows that check for changes in the Docker files. If any changes are detected, the relevant Docker image will be rebuilt and pushed (unless it's a pull request). The rebuilt images will be available after the merge.
1 parent c66beee commit 9b1fcb9

File tree

6 files changed

+192
-19
lines changed

6 files changed

+192
-19
lines changed
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Copyright (C) 2024 Intel Corporation
1+
# Copyright (C) 2024-2025 Intel Corporation
22
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

55
#
66
# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based
7-
# environment for building the Unified Memory Framework project.
7+
# environment for building the Unified Memory Framework project.
88
#
99

1010
# Pull base image ("20.04")
@@ -22,43 +22,50 @@ ARG BASE_DEPS="\
2222
cmake \
2323
git"
2424

25-
# UMF's dependencies
26-
ARG UMF_DEPS="\
27-
libhwloc-dev \
28-
libtbb-dev"
25+
# Hwloc installation dependencies
26+
ARG HWLOC_DEPS="\
27+
libtool"
2928

3029
# Dependencies for tests (optional)
3130
ARG TEST_DEPS="\
32-
libnuma-dev"
31+
libnuma-dev \
32+
libtbb-dev \
33+
valgrind"
3334

3435
# Miscellaneous for our builds/CI (optional)
3536
ARG MISC_DEPS="\
3637
automake \
3738
clang \
3839
g++-7 \
40+
lcov \
3941
python3-pip \
4042
sudo \
4143
whois"
4244

45+
# libhwloc-dev is required - installed via script because hwloc version is too old on this OS
46+
COPY .github/scripts/install_hwloc.sh /opt/umf/install_hwloc.sh
47+
4348
# Update and install required packages
4449
RUN apt-get update \
4550
&& apt-get install -y --no-install-recommends \
4651
${BASE_DEPS} \
47-
${UMF_DEPS} \
4852
${TEST_DEPS} \
4953
${MISC_DEPS} \
54+
${HWLOC_DEPS} \
55+
&& /opt/umf/install_hwloc.sh \
5056
&& rm -rf /var/lib/apt/lists/* \
5157
&& apt-get clean all
5258

5359
# Prepare a dir (accessible by anyone)
54-
RUN mkdir --mode 777 /opt/umf/
60+
RUN mkdir -p --mode 777 /opt/umf/
5561

5662
# Additional dependencies (installed via pip)
63+
# It's actively used and tested only on selected distros. Be aware
64+
# they may not work, because pip packages list differ from OS to OS.
5765
COPY third_party/requirements.txt /opt/umf/requirements.txt
58-
RUN pip3 install --no-cache-dir -r /opt/umf/requirements.txt
5966

6067
# Add a new (non-root) 'test_user'
6168
ENV USER test_user
6269
ENV USERPASS pass
63-
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
70+
RUN useradd -m -u 1001 "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
6471
USER test_user

.github/docker/ubuntu-22.04.Dockerfile

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2024 Intel Corporation
1+
# Copyright (C) 2024-2025 Intel Corporation
22
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

@@ -17,24 +17,30 @@ ENV NOTTY 1
1717
ENV DEBIAN_FRONTEND noninteractive
1818

1919
# Base development packages
20+
# It seems that libtool is not directly needed
21+
# but it is still required when Building UMF
2022
ARG BASE_DEPS="\
2123
build-essential \
2224
cmake \
23-
git"
25+
git \
26+
libtool \
27+
wget"
2428

2529
# UMF's dependencies
2630
ARG UMF_DEPS="\
27-
libhwloc-dev \
28-
libtbb-dev"
31+
libhwloc-dev"
2932

3033
# Dependencies for tests (optional)
3134
ARG TEST_DEPS="\
32-
libnuma-dev"
35+
libnuma-dev \
36+
libtbb-dev \
37+
valgrind"
3338

3439
# Miscellaneous for our builds/CI (optional)
3540
ARG MISC_DEPS="\
3641
automake \
3742
clang \
43+
lcov \
3844
python3-pip \
3945
sudo \
4046
whois"
@@ -43,14 +49,14 @@ ARG MISC_DEPS="\
4349
RUN apt-get update \
4450
&& apt-get install -y --no-install-recommends \
4551
${BASE_DEPS} \
46-
${UMF_DEPS} \
4752
${TEST_DEPS} \
4853
${MISC_DEPS} \
54+
${UMF_DEPS} \
4955
&& rm -rf /var/lib/apt/lists/* \
5056
&& apt-get clean all
5157

5258
# Prepare a dir (accessible by anyone)
53-
RUN mkdir --mode 777 /opt/umf/
59+
RUN mkdir -p --mode 777 /opt/umf/
5460

5561
# Additional dependencies (installed via pip)
5662
COPY third_party/requirements.txt /opt/umf/requirements.txt
@@ -59,5 +65,5 @@ RUN pip3 install --no-cache-dir -r /opt/umf/requirements.txt
5965
# Add a new (non-root) 'test_user'
6066
ENV USER test_user
6167
ENV USERPASS pass
62-
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
68+
RUN useradd -m -u 1001 "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
6369
USER test_user
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
#
6+
# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based
7+
# environment for building the Unified Memory Framework project.
8+
#
9+
10+
# Pull base image ("24.04")
11+
FROM registry.hub.docker.com/library/ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782
12+
13+
# Set environment variables
14+
ENV OS ubuntu
15+
ENV OS_VER 24.04
16+
ENV NOTTY 1
17+
ENV DEBIAN_FRONTEND noninteractive
18+
19+
# Base development packages
20+
ARG BASE_DEPS="\
21+
build-essential \
22+
cmake \
23+
git \
24+
wget"
25+
26+
# UMF's dependencies
27+
ARG UMF_DEPS="\
28+
libhwloc-dev"
29+
30+
# Dependencies for tests (optional)
31+
ARG TEST_DEPS="\
32+
libnuma-dev \
33+
libtbb-dev \
34+
valgrind"
35+
36+
# Miscellaneous for our builds/CI (optional)
37+
ARG MISC_DEPS="\
38+
automake \
39+
clang \
40+
lcov \
41+
python3-pip \
42+
sudo \
43+
whois"
44+
45+
# Update and install required packages
46+
RUN apt-get update \
47+
&& apt-get install -y --no-install-recommends \
48+
${BASE_DEPS} \
49+
${TEST_DEPS} \
50+
${MISC_DEPS} \
51+
${UMF_DEPS} \
52+
&& rm -rf /var/lib/apt/lists/* \
53+
&& apt-get clean all
54+
55+
# Prepare a dir (accessible by anyone)
56+
RUN mkdir -p --mode 777 /opt/umf/
57+
58+
# Additional dependencies (installed via pip)
59+
COPY third_party/requirements.txt /opt/umf/requirements.txt
60+
RUN pip3 install --no-cache-dir --break-system-packages -r /opt/umf/requirements.txt
61+
62+
# Add a new (non-root) 'test_user'
63+
ENV USER test_user
64+
ENV USERPASS pass
65+
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
66+
USER test_user

.github/workflows/detect_changes.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: DetectChanges
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/docker/*.Dockerfile'
7+
- '.github/scripts/*'
8+
push:
9+
paths:
10+
- '.github/docker/*.Dockerfile'
11+
- '.github/scripts/*'
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
DetectChanges:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Get changed files
28+
id: changed-files
29+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c #v46.0.5
30+
31+
- name: List all changed files
32+
env:
33+
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
34+
run: |
35+
echo "Changed files: $ALL_CHANGED_FILES"
36+
37+
BuildDocker:
38+
needs: DetectChanges
39+
if: ${{ contains(join(needs.DetectChanges.outputs.changed_files, ' '), '.github/docker/') }}
40+
uses: ./.github/workflows/reusable_dockers_build.yml
41+
permissions:
42+
contents: read
43+
packages: write
44+
secrets: inherit
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Build and push Docker images to GHCR
2+
name: BuildDockers
3+
4+
on:
5+
workflow_call:
6+
workflow_dispatch:
7+
8+
permissions:
9+
packages: write
10+
contents: read
11+
12+
jobs:
13+
build-dockers:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
18+
env:
19+
IMG: ghcr.io/bb-ur/umf-${{ matrix.os }}:latest
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Build ${{ matrix.os }} Docker image
28+
run: |
29+
docker build -f .github/docker/${{ matrix.os }}.Dockerfile -t ${{ env.IMG }} .
30+
31+
- name: Login to GitHub Container Registry
32+
if: github.event_name != 'pull_request'
33+
uses: docker/login-action@30f019fb76bb54d03ec1e716054622be511a13b2 # v3.2.0
34+
with:
35+
registry: ghcr.io
36+
username: bb-ur
37+
password: ${{ secrets.BB_GHCR_TOKEN }}
38+
39+
- name: Push ${{ matrix.os }} Docker image
40+
if: github.event_name != 'pull_request'
41+
run: |
42+
docker push ${{ env.IMG }}

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [Opening new issues](#opening-new-issues)
77
- [Submitting Pull Requests](#submitting-pull-requests)
88
- [Building and testing](#building-and-testing)
9+
- [Building/Rebuilding Docker Images](#buildingrebuilding-docker-images)
910
- [Code style](#code-style)
1011
- [When my PR is merged?](#when-my-pr-is-merged)
1112
- [Extending public API](#extending-public-api)
@@ -67,6 +68,13 @@ To enable additional checks (including `-Werror` / `/WX` compilation flag), swit
6768
`UMF_DEVELOPER_MODE`. To read more about all available CMake options please see
6869
["CMake standard options"](./README.md#cmake-standard-options) section in the top-level Readme.
6970

71+
### Building/Rebuilding Docker Images
72+
73+
If you want to rebuild existing Docker images or add a new one, you must open a separate pull
74+
request dedicated to Docker-related changes. This PR must be merged into the main branch first.
75+
76+
The updated Docker images will be available for use in workflows only when this PR is merged.
77+
7078
### Code style
7179
We use `clang-format` to verify and apply code style changes to C/C++ source files.
7280
To see all rules we require, please take a look at `.clang-format` file in the

0 commit comments

Comments
 (0)