Skip to content

Commit 99e50fd

Browse files
Add Ubuntu dockers
1 parent 6e15eb7 commit 99e50fd

File tree

3 files changed

+174
-0
lines changed

3 files changed

+174
-0
lines changed

.github/docker/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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. If you want to use below instructions with `podman`,
8+
simply replace word `docker` with `podman`.
9+
10+
# How to build docker image
11+
12+
To build docker image on local machine enter the root dir of the repository and execute:
13+
14+
```sh
15+
docker build -t ur:ubuntu-22.04 -f .github/docker/ubuntu-22.04.Dockerfile .
16+
```
17+
18+
To set any build time variable (e.g., an optional ARG from docker recipe), add to the command (after `build`), e.g.:
19+
20+
```sh
21+
--build-arg TEST_DEPS=""
22+
```
23+
24+
One other example of using these extra build arguments are proxy settings. They are required for accessing network
25+
(e.g., to download dependencies within docker), if a host is using a proxy server. Example usage:
26+
27+
```sh
28+
--build-arg https_proxy=http://proxy.com:port --build-arg http_proxy=http://proxy.com:port
29+
```
30+
31+
# How to use docker image
32+
33+
To run docker container (using the previously built image) execute:
34+
35+
```sh
36+
docker run --shm-size=4G -v /your/workspace/path/:/opt/workspace:z -w /opt/workspace/ -it ur:ubuntu-22.04 /bin/bash
37+
```
38+
39+
To set (or override) any docker environment variable, add to the command (after `run`):
40+
41+
```sh
42+
-e ENV_VARIABLE=VALUE
43+
```
44+
45+
To start as a non-root user, add to the command (after `run`):
46+
47+
```sh
48+
--user test_user
49+
```
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
#
6+
# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based
7+
# environment for building the Unified Memory Framework project.
8+
#
9+
10+
# Pull base image ("20.04")
11+
FROM registry.hub.docker.com/library/ubuntu@sha256:f2034e7195f61334e6caff6ecf2e965f92d11e888309065da85ff50c617732b8
12+
13+
# Set environment variables
14+
ENV OS ubuntu
15+
ENV OS_VER 20.04
16+
ENV NOTTY 1
17+
ENV DEBIAN_FRONTEND noninteractive
18+
19+
# Base development packages
20+
ARG BASE_DEPS="\
21+
build-essential \
22+
cmake \
23+
git"
24+
25+
# UMF's dependencies
26+
ARG UMF_DEPS="\
27+
libjemalloc-dev \
28+
libhwloc-dev \
29+
libtbb-dev"
30+
31+
# Dependencies for tests (optional)
32+
ARG TEST_DEPS="\
33+
libnuma-dev"
34+
35+
# Miscellaneous for our builds/CI (optional)
36+
ARG MISC_DEPS="\
37+
clang \
38+
g++-7 \
39+
python3-pip \
40+
sudo \
41+
whois"
42+
43+
# Update and install required packages
44+
RUN apt-get update \
45+
&& apt-get install -y --no-install-recommends \
46+
${BASE_DEPS} \
47+
${UMF_DEPS} \
48+
${TEST_DEPS} \
49+
${MISC_DEPS} \
50+
&& rm -rf /var/lib/apt/lists/* \
51+
&& apt-get clean all
52+
53+
# Prepare a dir (accessible by anyone)
54+
RUN mkdir --mode 777 /opt/umf/
55+
56+
# Additional dependencies (installed via pip)
57+
COPY third_party/requirements.txt /opt/umf/requirements.txt
58+
RUN pip3 install --no-cache-dir -r /opt/umf/requirements.txt
59+
60+
# Add a new (non-root) 'test_user'
61+
ENV USER test_user
62+
ENV USERPASS pass
63+
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
#
6+
# Dockerfile - a 'recipe' for Docker to build an image of ubuntu-based
7+
# environment for building the Unified Memory Framework project.
8+
#
9+
10+
# Pull base image ("22.04")
11+
FROM registry.hub.docker.com/library/ubuntu@sha256:e6173d4dc55e76b87c4af8db8821b1feae4146dd47341e4d431118c7dd060a74
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+
# Base development packages
20+
ARG BASE_DEPS="\
21+
build-essential \
22+
cmake \
23+
git"
24+
25+
# UMF's dependencies
26+
ARG UMF_DEPS="\
27+
libjemalloc-dev \
28+
libhwloc-dev \
29+
libtbb-dev"
30+
31+
# Dependencies for tests (optional)
32+
ARG TEST_DEPS="\
33+
libnuma-dev"
34+
35+
# Miscellaneous for our builds/CI (optional)
36+
ARG MISC_DEPS="\
37+
clang \
38+
python3-pip \
39+
sudo \
40+
whois"
41+
42+
# Update and install required packages
43+
RUN apt-get update \
44+
&& apt-get install -y --no-install-recommends \
45+
${BASE_DEPS} \
46+
${UMF_DEPS} \
47+
${TEST_DEPS} \
48+
${MISC_DEPS} \
49+
&& rm -rf /var/lib/apt/lists/* \
50+
&& apt-get clean all
51+
52+
# Prepare a dir (accessible by anyone)
53+
RUN mkdir --mode 777 /opt/umf/
54+
55+
# Additional dependencies (installed via pip)
56+
COPY third_party/requirements.txt /opt/umf/requirements.txt
57+
RUN pip3 install --no-cache-dir -r /opt/umf/requirements.txt
58+
59+
# Add a new (non-root) 'test_user'
60+
ENV USER test_user
61+
ENV USERPASS pass
62+
RUN useradd -m "${USER}" -g sudo -p "$(mkpasswd ${USERPASS})"

0 commit comments

Comments
 (0)