|
| 1 | +# Copyright (C) 2023-2024 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 - a 'recipe' for Docker to build an image of rockylinux-based |
| 8 | +# environment for building the Unified Runtime project. |
| 9 | +# |
| 10 | + |
| 11 | +# Pull base image ("8.9") |
| 12 | +FROM registry.hub.docker.com/library/rockylinux@sha256:9794037624aaa6212aeada1d28861ef5e0a935adaf93e4ef79837119f2a2d04c |
| 13 | + |
| 14 | +# Set environment variables |
| 15 | +ENV OS rockylinux |
| 16 | +ENV OS_VER 8 |
| 17 | +ENV NOTTY 1 |
| 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 | + cmake \ |
| 28 | + git \ |
| 29 | + glibc-devel \ |
| 30 | + libstdc++-devel \ |
| 31 | + make" |
| 32 | + |
| 33 | +# Unified Runtime's dependencies |
| 34 | +ARG UR_DEPS="\ |
| 35 | + doxygen \ |
| 36 | + python3 \ |
| 37 | + python3-pip" |
| 38 | + |
| 39 | +# Packages required by requirements.txt |
| 40 | +ARG PRE_PYTHON_DEPS="\ |
| 41 | + libjpeg-turbo-devel \ |
| 42 | + python3-devel \ |
| 43 | + python3-wheel \ |
| 44 | + zlib-devel" |
| 45 | + |
| 46 | +# Miscellaneous for our builds/CI (optional) |
| 47 | +ARG MISC_DEPS="\ |
| 48 | + clang \ |
| 49 | + ncurses-libs-6.1 \ |
| 50 | + passwd \ |
| 51 | + sudo \ |
| 52 | + wget" |
| 53 | + |
| 54 | +# Update and install required packages |
| 55 | +RUN dnf update -y \ |
| 56 | + && dnf --enablerepo devel install -y \ |
| 57 | + ${BASE_DEPS} \ |
| 58 | + ${UR_DEPS} \ |
| 59 | + ${PRE_PYTHON_DEPS} \ |
| 60 | + ${MISC_DEPS} \ |
| 61 | + && dnf clean all |
| 62 | + |
| 63 | +# Prepare a dir (accessible by anyone) |
| 64 | +RUN mkdir --mode 777 /opt/ur/ |
| 65 | + |
| 66 | +# Additional dev. dependencies (installed via pip) |
| 67 | +# |
| 68 | +# It's actively used and tested only on selected distros. Be aware |
| 69 | +# they may not work, because pip packages list differ from OS to OS. |
| 70 | +COPY third_party/requirements.txt /opt/ur/requirements.txt |
| 71 | + |
| 72 | +# Install DPC++ |
| 73 | +COPY .github/docker/install_dpcpp.sh /opt/ur/install_dpcpp.sh |
| 74 | +ENV DPCPP_PATH=/opt/dpcpp |
| 75 | +RUN /opt/ur/install_dpcpp.sh |
| 76 | + |
| 77 | +# Install libbacktrace |
| 78 | +COPY .github/docker/install_libbacktrace.sh /opt/ur/install_libbacktrace.sh |
| 79 | +RUN /opt/ur/install_libbacktrace.sh |
| 80 | + |
| 81 | +# Add a new (non-root) 'test_user' |
| 82 | +ENV USER test_user |
| 83 | +ENV USERPASS pass |
| 84 | +# Change shell to bash with safe pipe usage |
| 85 | +SHELL [ "/bin/bash", "-o", "pipefail", "-c" ] |
| 86 | +RUN useradd -m $USER \ |
| 87 | + && echo "${USERPASS}" | passwd "${USER}" --stdin \ |
| 88 | + && gpasswd wheel -a "${USER}" \ |
| 89 | + && echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
| 90 | + |
| 91 | +# Change shell back to default and switch to 'test_user' |
| 92 | +SHELL ["/bin/sh", "-c"] |
| 93 | +USER test_user |
0 commit comments