Skip to content

Build dockers #1298

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

Merged
merged 1 commit into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions .github/docker/ubuntu-20.04.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (C) 2024 Intel Corporation
# Copyright (C) 2024-2025 Intel Corporation
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#
# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based
# environment for building the Unified Memory Framework project.
# environment for building the Unified Memory Framework project.
#

# Pull base image ("20.04")
Expand All @@ -22,43 +22,50 @@ ARG BASE_DEPS="\
cmake \
git"

# UMF's dependencies
ARG UMF_DEPS="\
libhwloc-dev \
libtbb-dev"
# Hwloc installation dependencies
ARG HWLOC_DEPS="\
libtool"

# Dependencies for tests (optional)
ARG TEST_DEPS="\
libnuma-dev"
libnuma-dev \
libtbb-dev \
valgrind"

# Miscellaneous for our builds/CI (optional)
ARG MISC_DEPS="\
automake \
clang \
g++-7 \
lcov \
python3-pip \
sudo \
whois"

# libhwloc-dev is required - installed via script because hwloc version is too old on this OS
COPY .github/scripts/install_hwloc.sh /opt/umf/install_hwloc.sh

# Update and install required packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
${BASE_DEPS} \
${UMF_DEPS} \
${TEST_DEPS} \
${MISC_DEPS} \
${HWLOC_DEPS} \
&& /opt/umf/install_hwloc.sh \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean all

# Prepare a dir (accessible by anyone)
RUN mkdir --mode 777 /opt/umf/
RUN mkdir -p --mode 777 /opt/umf/

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

# Add a new (non-root) 'test_user'
ENV USER test_user
ENV USERPASS pass
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
RUN useradd -m -u 1001 "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
USER test_user
22 changes: 14 additions & 8 deletions .github/docker/ubuntu-22.04.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2024 Intel Corporation
# Copyright (C) 2024-2025 Intel Corporation
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

Expand All @@ -17,24 +17,30 @@ ENV NOTTY 1
ENV DEBIAN_FRONTEND noninteractive

# Base development packages
# It seems that libtool is not directly needed
# but it is still required when Building UMF
ARG BASE_DEPS="\
build-essential \
cmake \
git"
git \
libtool \
wget"

# UMF's dependencies
ARG UMF_DEPS="\
libhwloc-dev \
libtbb-dev"
libhwloc-dev"

# Dependencies for tests (optional)
ARG TEST_DEPS="\
libnuma-dev"
libnuma-dev \
libtbb-dev \
valgrind"

# Miscellaneous for our builds/CI (optional)
ARG MISC_DEPS="\
automake \
clang \
lcov \
python3-pip \
sudo \
whois"
Expand All @@ -43,14 +49,14 @@ ARG MISC_DEPS="\
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
${BASE_DEPS} \
${UMF_DEPS} \
${TEST_DEPS} \
${MISC_DEPS} \
${UMF_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean all

# Prepare a dir (accessible by anyone)
RUN mkdir --mode 777 /opt/umf/
RUN mkdir -p --mode 777 /opt/umf/

# Additional dependencies (installed via pip)
COPY third_party/requirements.txt /opt/umf/requirements.txt
Expand All @@ -59,5 +65,5 @@ RUN pip3 install --no-cache-dir -r /opt/umf/requirements.txt
# Add a new (non-root) 'test_user'
ENV USER test_user
ENV USERPASS pass
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
RUN useradd -m -u 1001 "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
USER test_user
66 changes: 66 additions & 0 deletions .github/docker/ubuntu-24.04.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright (C) 2025 Intel Corporation
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#
# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based
# environment for building the Unified Memory Framework project.
#

# Pull base image ("24.04")
FROM registry.hub.docker.com/library/ubuntu@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09856619a782

# Set environment variables
ENV OS ubuntu
ENV OS_VER 24.04
ENV NOTTY 1
ENV DEBIAN_FRONTEND noninteractive

# Base development packages
ARG BASE_DEPS="\
build-essential \
cmake \
git \
wget"

# UMF's dependencies
ARG UMF_DEPS="\
libhwloc-dev"

# Dependencies for tests (optional)
ARG TEST_DEPS="\
libnuma-dev \
libtbb-dev \
valgrind"

# Miscellaneous for our builds/CI (optional)
ARG MISC_DEPS="\
automake \
clang \
lcov \
python3-pip \
sudo \
whois"

# Update and install required packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
${BASE_DEPS} \
${TEST_DEPS} \
${MISC_DEPS} \
${UMF_DEPS} \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean all

# Prepare a dir (accessible by anyone)
RUN mkdir -p --mode 777 /opt/umf/

# Additional dependencies (installed via pip)
COPY third_party/requirements.txt /opt/umf/requirements.txt
RUN pip3 install --no-cache-dir --break-system-packages -r /opt/umf/requirements.txt

# Add a new (non-root) 'test_user'
ENV USER test_user
ENV USERPASS pass
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
USER test_user
44 changes: 44 additions & 0 deletions .github/workflows/detect_changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: DetectChanges

on:
pull_request:
paths:
- '.github/docker/*.Dockerfile'
- '.github/scripts/*'
push:
paths:
- '.github/docker/*.Dockerfile'
- '.github/scripts/*'

permissions:
contents: read

jobs:
DetectChanges:
runs-on: ubuntu-latest
outputs:
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c #v46.0.5

- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "Changed files: $ALL_CHANGED_FILES"

BuildDocker:
needs: DetectChanges
if: ${{ contains(join(needs.DetectChanges.outputs.changed_files, ' '), '.github/docker/') }}
uses: ./.github/workflows/reusable_dockers_build.yml
permissions:
contents: read
packages: write
secrets: inherit
42 changes: 42 additions & 0 deletions .github/workflows/reusable_dockers_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Build and push Docker images to GHCR
name: BuildDockers

on:
workflow_call:
workflow_dispatch:

permissions:
packages: write
contents: read

jobs:
build-dockers:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
env:
IMG: ghcr.io/bb-ur/umf-${{ matrix.os }}:latest

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Build ${{ matrix.os }} Docker image
run: |
docker build -f .github/docker/${{ matrix.os }}.Dockerfile -t ${{ env.IMG }} .

- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@30f019fb76bb54d03ec1e716054622be511a13b2 # v3.2.0
with:
registry: ghcr.io
username: bb-ur
password: ${{ secrets.BB_GHCR_TOKEN }}

- name: Push ${{ matrix.os }} Docker image
if: github.event_name != 'pull_request'
run: |
docker push ${{ env.IMG }}
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Opening new issues](#opening-new-issues)
- [Submitting Pull Requests](#submitting-pull-requests)
- [Building and testing](#building-and-testing)
- [Building/Rebuilding Docker Images](#buildingrebuilding-docker-images)
- [Code style](#code-style)
- [When my PR is merged?](#when-my-pr-is-merged)
- [Extending public API](#extending-public-api)
Expand Down Expand Up @@ -67,6 +68,13 @@ To enable additional checks (including `-Werror` / `/WX` compilation flag), swit
`UMF_DEVELOPER_MODE`. To read more about all available CMake options please see
["CMake standard options"](./README.md#cmake-standard-options) section in the top-level Readme.

### Building/Rebuilding Docker Images

If you want to rebuild existing Docker images or add a new one, you must open a separate pull
request dedicated to Docker-related changes. This PR must be merged into the main branch first.

The updated Docker images will be available for use in workflows only when this PR is merged.

### Code style
We use `clang-format` to verify and apply code style changes to C/C++ source files.
To see all rules we require, please take a look at `.clang-format` file in the
Expand Down
Loading