diff --git a/.github/docker/README.md b/.github/docker/README.md new file mode 100644 index 0000000000..782dce372e --- /dev/null +++ b/.github/docker/README.md @@ -0,0 +1,42 @@ +# Content + +Dockerfiles and scripts placed in this directory are intended to be used as +development process vehicles and part of continuous integration process. + +Images built out of those recipes may be used with Docker or podman as +development environment. + +# How to build docker image + +To build docker image on local machine execute: + +```sh +docker build -t ur:ubuntu-22.04 -f ./ubuntu-22.04.Dockerfile . +``` + +To set any build time variable (e.g., an optional ARG from docker recipe), add to the command (after `build`), e.g.: + +```sh + --build-arg SKIP_DPCPP_BUILD=1 +``` + +One other example of using these extra build arguments are proxy settings. They are required for accessing network +(e.g., to download dependencies within docker), if a host is using a proxy server. Example usage: + +```sh + --build-arg https_proxy=http://proxy.com:port --build-arg http_proxy=http://proxy.com:port +``` + +# How to use docker image + +To run docker container (using the previously built image) execute: + +```sh +docker run --shm-size=4G -v /your/workspace/path/:/opt/workspace:z -w /opt/workspace/ -it ur:ubuntu-22.04 /bin/bash +``` + +To set (or override) any docker environment variable, add to the command (after `run`): + +```sh + -e ENV_VARIABLE=VALUE +``` diff --git a/.github/docker/install_dpcpp.sh b/.github/docker/install_dpcpp.sh new file mode 100755 index 0000000000..0aac93eee4 --- /dev/null +++ b/.github/docker/install_dpcpp.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Copyright (C) 2023 Intel Corporation +# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +# See LICENSE.TXT +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# +# install_dpcpp.sh - unpacks DPC++ in ${DPCPP_PATH}, to be used while building UR +# + +set -e + +if [ "${SKIP_DPCPP_BUILD}" ]; then + echo "Variable 'SKIP_DPCPP_BUILD' is set; skipping building DPC++" + exit +fi + +apt-get install -y --no-install-recommends \ + libncurses5 + +mkdir -p ${DPCPP_PATH} +wget -O ${DPCPP_PATH}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz +tar -xvf ${DPCPP_PATH}/dpcpp_compiler.tar.gz -C ${DPCPP_PATH}/ diff --git a/.github/docker/install_libbacktrace.sh b/.github/docker/install_libbacktrace.sh new file mode 100755 index 0000000000..ae364ddb13 --- /dev/null +++ b/.github/docker/install_libbacktrace.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Copyright (C) 2023 Intel Corporation +# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +# See LICENSE.TXT +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# +# install_libbacktrace.sh - builds and installs tracing library +# + +set -e + +if [ "${SKIP_LIBBACKTRACE_BUILD}" ]; then + echo "Variable 'SKIP_LIBBACKTRACE_BUILD' is set; skipping building libbacktrace" + exit +fi + +git clone https://github.com/ianlancetaylor/libbacktrace.git +pushd libbacktrace +./configure +make -j$(nproc) +make install -j$(nproc) +popd diff --git a/.github/docker/ubuntu-22.04.Dockerfile b/.github/docker/ubuntu-22.04.Dockerfile new file mode 100644 index 0000000000..38161f5b6e --- /dev/null +++ b/.github/docker/ubuntu-22.04.Dockerfile @@ -0,0 +1,70 @@ +# Copyright (C) 2023 Intel Corporation +# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +# See LICENSE.TXT +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# +# Dockerfile - image with all Unified Runtime dependencies. +# + +# Pull base image +FROM registry.hub.docker.com/library/ubuntu:22.04 + +# Set environment variables +ENV OS ubuntu +ENV OS_VER 22.04 +ENV NOTTY 1 +ENV DEBIAN_FRONTEND noninteractive + +# Additional parameters to build docker without building components. +# These ARGs can be set in docker building phase and are used +# within bash scripts (executed within docker). +ARG SKIP_DPCPP_BUILD +ARG SKIP_LIBBACKTRACE_BUILD + +# Base development packages +ARG BASE_DEPS="\ + build-essential \ + cmake \ + git" + +# Unified Runtime's dependencies +ARG UR_DEPS="\ + doxygen \ + python3 \ + python3-pip" + +# Unified Runtime's dependencies (installed via pip) +ARG UR_PYTHON_DEPS="\ + clang-format==15.0.7" + +# Miscellaneous for our builds/CI (optional) +ARG MISC_DEPS="\ + clang \ + sudo \ + wget \ + whois" + +# Update and install required packages +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ${BASE_DEPS} \ + ${UR_DEPS} \ + ${MISC_DEPS} \ + && apt-get clean all + +RUN pip3 install ${UR_PYTHON_DEPS} + +# Install DPC++ +COPY install_dpcpp.sh install_dpcpp.sh +ENV DPCPP_PATH=/opt/dpcpp +RUN ./install_dpcpp.sh + +# Install libbacktrace +COPY install_libbacktrace.sh install_libbacktrace.sh +RUN ./install_libbacktrace.sh + +# Add a new (non-root) 'user' +ENV USER user +ENV USERPASS pass +RUN useradd -m $USER -g sudo -p `mkpasswd $USERPASS`