Skip to content

Commit d8922f8

Browse files
Add first Docker image recipe
This image can be used in CI or as a development container.
1 parent e73389f commit d8922f8

File tree

4 files changed

+158
-0
lines changed

4 files changed

+158
-0
lines changed

.github/docker/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Content
2+
3+
Dockerfiles and scripts placed in this directory are intended to be used as
4+
development process vehicles and part of continuous integration process.
5+
6+
Images built out of those recipes may be used with Docker or podman as
7+
development environment.
8+
9+
# How to build docker image
10+
11+
To build docker image on local machine execute:
12+
13+
```sh
14+
docker build -t ur:ubuntu-22.04 -f ./ubuntu-22.04.Dockerfile .
15+
```
16+
17+
To set any build time variable (e.g., an optional ARG from docker recipe), add to the command (after `build`), e.g.:
18+
19+
```sh
20+
--build-arg SKIP_DPCPP_BUILD=1
21+
```
22+
23+
One other example of using these extra build arguments are proxy settings. They are required for accessing network
24+
(e.g., to download dependencies within docker), if a host is using a proxy server. Example usage:
25+
26+
```sh
27+
--build-arg https_proxy=http://proxy.com:port --build-arg http_proxy=http://proxy.com:port
28+
```
29+
30+
# How to use docker image
31+
32+
To run docker container (using the previously built image) execute:
33+
34+
```sh
35+
docker run --shm-size=4G -v /your/workspace/path/:/opt/workspace:z -w /opt/workspace/ -it ur:ubuntu-22.04 /bin/bash
36+
```
37+
38+
To set (or override) any docker environment variable, add to the command (after `run`):
39+
40+
```sh
41+
-e ENV_VARIABLE=VALUE
42+
```

.github/docker/install_dpcpp.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
# Copyright (C) 2023 Intel Corporation
3+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See LICENSE.TXT
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
7+
#
8+
# install_dpcpp.sh - unpacks DPC++ in ${DPCPP_PATH}, to be used while building UR
9+
#
10+
11+
set -e
12+
13+
if [ "${SKIP_DPCPP_BUILD}" ]; then
14+
echo "Variable 'SKIP_DPCPP_BUILD' is set; skipping building DPC++"
15+
exit
16+
fi
17+
18+
apt-get install -y --no-install-recommends \
19+
libncurses5
20+
21+
mkdir -p ${DPCPP_PATH}
22+
wget -O ${DPCPP_PATH}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz
23+
tar -xvf ${DPCPP_PATH}/dpcpp_compiler.tar.gz -C ${DPCPP_PATH}/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
# Copyright (C) 2023 Intel Corporation
3+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See LICENSE.TXT
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
7+
#
8+
# install_libbacktrace.sh - builds and installs tracing library
9+
#
10+
11+
set -e
12+
13+
if [ "${SKIP_LIBBACKTRACE_BUILD}" ]; then
14+
echo "Variable 'SKIP_LIBBACKTRACE_BUILD' is set; skipping building libbacktrace"
15+
exit
16+
fi
17+
18+
git clone https://github.com/ianlancetaylor/libbacktrace.git
19+
pushd libbacktrace
20+
./configure
21+
make -j$(nproc)
22+
make install -j$(nproc)
23+
popd
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright (C) 2023 Intel Corporation
2+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See LICENSE.TXT
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
#
7+
# Dockerfile - image with all Unified Runtime dependencies.
8+
#
9+
10+
# Pull base image
11+
FROM registry.hub.docker.com/library/ubuntu:22.04
12+
13+
# Set environment variables
14+
ENV OS ubuntu
15+
ENV OS_VER 22.04
16+
ENV NOTTY 1
17+
ENV DEBIAN_FRONTEND noninteractive
18+
19+
# Additional parameters to build docker without building components.
20+
# These ARGs can be set in docker building phase and are used
21+
# within bash scripts (executed within docker).
22+
ARG SKIP_DPCPP_BUILD
23+
ARG SKIP_LIBBACKTRACE_BUILD
24+
25+
# Base development packages
26+
ARG BASE_DEPS="\
27+
build-essential \
28+
cmake \
29+
git"
30+
31+
# Unified Runtime's dependencies
32+
ARG UR_DEPS="\
33+
doxygen \
34+
python3 \
35+
python3-pip"
36+
37+
# Unified Runtime's dependencies (installed via pip)
38+
ARG UR_PYTHON_DEPS="\
39+
clang-format==15.0.7"
40+
41+
# Miscellaneous for our builds/CI (optional)
42+
ARG MISC_DEPS="\
43+
clang \
44+
sudo \
45+
wget \
46+
whois"
47+
48+
# Update and install required packages
49+
RUN apt-get update \
50+
&& apt-get install -y --no-install-recommends \
51+
${BASE_DEPS} \
52+
${UR_DEPS} \
53+
${MISC_DEPS} \
54+
&& apt-get clean all
55+
56+
RUN pip3 install ${UR_PYTHON_DEPS}
57+
58+
# Install DPC++
59+
COPY install_dpcpp.sh install_dpcpp.sh
60+
ENV DPCPP_PATH=/opt/dpcpp
61+
RUN ./install_dpcpp.sh
62+
63+
# Install libbacktrace
64+
COPY install_libbacktrace.sh install_libbacktrace.sh
65+
RUN ./install_libbacktrace.sh
66+
67+
# Add a new (non-root) 'user'
68+
ENV USER user
69+
ENV USERPASS pass
70+
RUN useradd -m $USER -g sudo -p `mkpasswd $USERPASS`

0 commit comments

Comments
 (0)