Skip to content

Commit 08c5b16

Browse files
committed
Build UMF on Alpine image
1 parent 2c5f602 commit 08c5b16

File tree

5 files changed

+67
-19
lines changed

5 files changed

+67
-19
lines changed

.github/docker/alpine-3.20.Dockerfile renamed to .github/docker/alpine-3.21.Dockerfile

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,40 @@
77
# environment for building the Unified Memory Framework project.
88
#
99

10-
# Pull base Alpine image version 3.20
11-
FROM alpine:3.20
10+
# Pull base Alpine image version 3.21
11+
FROM registry.hub.docker.com/library/alpine@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c
1212

1313
# Set environment variables
14-
ENV OS alpine
15-
ENV OS_VER 3.20
14+
ENV OS=alpine
15+
ENV OS_VER=3.21
1616

1717
# Base development packages
1818
ARG BASE_DEPS="\
19+
bash \
1920
cmake \
2021
git \
21-
g++ \
22-
make"
22+
g++ \
23+
make \
24+
sudo"
2325

2426
# UMF's dependencies
2527
ARG UMF_DEPS="\
2628
hwloc-dev"
2729

28-
# Add a new (non-root) 'test_user'
29-
ENV USER test_user
30-
ENV USERPASS pass
31-
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
32-
USER test_user
30+
# Dependencies for tests
31+
ARG TEST_DEPS="\
32+
numactl-dev"
3333

3434
# Update and install required packages
3535
RUN apk update \
36-
&& apk add \
36+
&& apk add --no-cache \
3737
${BASE_DEPS} \
38+
${TEST_DEPS} \
3839
${UMF_DEPS}
3940

40-
# clone the repository
41-
RUN git clone https://github.com/oneapi-src/unified-memory-framework.git
41+
# Add a new (non-root) 'test_user'
42+
ENV USER=test_user
43+
RUN adduser -D -G wheel ${USER}
44+
RUN echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
4245

43-
# build the project
44-
RUN cd unified-memory-framework \
45-
cmake -B build -DCMAKE_BUILD_TYPE=Release -DUMF_BUILD_TESTS=ON -DUMF_BUILD_EXAMPLES=OFF \
46-
cmake --build build
46+
USER test_user

.github/docker/ubuntu-20.04.Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,3 @@ RUN pip3 install --no-cache-dir -r /opt/umf/requirements.txt
6161
ENV USER test_user
6262
ENV USERPASS pass
6363
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
64-
USER test_user

.github/scripts/alpine_build.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# Copyright (C) 2025 Intel Corporation
3+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
# alpine_build.sh - Script for building UMF on Alpine image
7+
8+
set -e
9+
10+
UMF_BUILD_TYPE=$1
11+
WORKDIR=$2
12+
13+
sudo chown $USER $WORKDIR
14+
cd unified-memory-framework
15+
16+
cmake -B build -DCMAKE_BUILD_TYPE=$UMF_BUILD_TYPE -DUMF_BUILD_TESTS=ON -DUMF_BUILD_EXAMPLES=ON
17+
cmake --build build

.github/workflows/nightly.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ permissions:
1313
env:
1414
BUILD_DIR : "${{github.workspace}}/build"
1515
INSTALL_DIR: "${{github.workspace}}/build/install"
16+
HOST_WORKDIR: ${{github.workspace}}
17+
WORKDIR: /unified-memory-framework
1618

1719
jobs:
1820
fuzz-test:
@@ -370,3 +372,26 @@ jobs:
370372

371373
SYCL:
372374
uses: ./.github/workflows/reusable_sycl.yml
375+
376+
alpine:
377+
name: Alpine
378+
strategy:
379+
fail-fast: false
380+
matrix:
381+
build_type: [Debug, Release]
382+
runs-on: ubuntu-latest
383+
384+
steps:
385+
- name: Checkout repository
386+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
387+
with:
388+
fetch-depth: 0
389+
390+
- name: Build Alpine image
391+
run: |
392+
docker build . -f .github/docker/alpine-3.21.Dockerfile -t umf-alpine-3.21
393+
394+
- name: Run UMF build on Alpine image
395+
run: |
396+
docker run --rm -i -v $HOST_WORKDIR:$WORKDIR \
397+
umf-alpine-3.21 $WORKDIR/.github/scripts/alpine_build.sh ${{matrix.build_type}} $WORKDIR

.github/workflows/reusable_trivy.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@ jobs:
1919
with:
2020
fetch-depth: 0
2121

22+
- name: Manual Trivy Setup
23+
uses: aquasecurity/setup-trivy@9ea583eb67910444b1f64abf338bd2e105a0a93d
24+
with:
25+
cache: true
26+
version: v0.61.0
27+
2228
- name: Run Trivy
2329
uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0
2430
with:
2531
scan-type: 'config'
2632
hide-progress: false
2733
format: 'sarif'
2834
output: 'trivy-results.sarif'
35+
skip-setup-trivy: true
2936
exit-code: 1 # Fail if issue found
3037
# file with suppressions: .trivyignore (in root dir)
3138

0 commit comments

Comments
 (0)