-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #734 from lukaszstolarczuk/add-docker-image
Add first Docker image recipe
- Loading branch information
Showing
4 changed files
with
158 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` |