Skip to content

Commit 859025f

Browse files
authored
Move HE samples to separate docker layer (#190)
Signed-off-by: Jack Crawford <[email protected]>
1 parent a395e90 commit 859025f

6 files changed

+53
-10
lines changed

Diff for: docker/Dockerfile.samples

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
ARG CUSTOM_FROM
5+
6+
FROM $CUSTOM_FROM
7+
8+
LABEL maintainer="https://github.com/intel/he-toolkit"
9+
10+
# User setup
11+
ARG UNAME
12+
ARG UID
13+
ARG GID
14+
ARG HOME="/home/$UNAME"
15+
ENV SHELL="/bin/bash"
16+
17+
# Switch user to $UNAME
18+
USER $UNAME
19+
20+
# Change directories to $HOME/he-toolkit
21+
WORKDIR $HOME/he-toolkit
22+
23+
# Build and install libraries, examples, and kernels
24+
RUN ./hekit install recipes/default.toml && \
25+
./hekit build recipes/examples.toml --recipe_arg "toolkit-path=${HOME}/he-toolkit" && \
26+
./hekit build recipes/sample-kernels.toml --recipe_arg "toolkit-path=${HOME}/he-toolkit"
27+
28+
ENTRYPOINT . docker/runners.sh && welcome_message && cd $HOME && /bin/bash

Diff for: docker/Dockerfile.toolkit

+1-4
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ RUN ["pip", "install", "toml", "argcomplete"]
4545
WORKDIR $HOME/he-toolkit
4646

4747
# Initialize hekit and install librares, examples, and kernels
48-
RUN echo "y" | ./hekit init --default-config && \
49-
./hekit install recipes/default.toml && \
50-
./hekit build recipes/examples.toml --recipe_arg "toolkit-path=${HOME}/he-toolkit" && \
51-
./hekit build recipes/sample-kernels.toml --recipe_arg "toolkit-path=${HOME}/he-toolkit"
48+
RUN echo "y" | ./hekit init --default-config
5249

5350
ENTRYPOINT . docker/runners.sh && welcome_message && cd $HOME && /bin/bash

Diff for: docker/Dockerfile.vscode

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ RUN for e in vscode.cpp twxs.cmake ms-vscode.cmake-tools vadimcn.vscode-lldb; do
2727
code-server --user-data-dir=$HOME/ --install-extension $e; \
2828
done
2929

30-
3130
# Update code-server user settings
3231
RUN echo '{"extensions.autoUpdate": false, "workbench.colorTheme": "Default Dark+"}' |\
3332
jq . > $HOME/User/settings.json && \

Diff for: docker/README.md

+22-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Steps](#steps)
1212
- [Using VS Code Server](#using-vs-code-server)
1313
- [Using Custom Dockerfiles](#using-custom-dockerfiles)
14+
- [Using a Custom Base Platform](#using-a-custom-base-platform)
1415
- [Running the Examples](#running-the-examples)
1516
- [Docker Controls](#docker-controls)
1617
- [Commands used inside the Docker Container](#commands-used-inside-the-docker-container)
@@ -90,10 +91,22 @@ on `Apply & Restart`.
9091
memory. This can be done via the `Resources` tab under `Preferences`.
9192

9293
### Steps
93-
To build and run the Intel HE Toolkit container run
94+
To build the base docker container run
9495
```bash
9596
hekit docker-build
9697
```
98+
This will build a base image containing the necessary dependencies and then an
99+
image containing the HE Toolkit repository with the `hekit` command enabled.
100+
This can be useful as a base for users to use the HE Toolkit to build a subset
101+
of the provided sample kernels and examples or an entirely custom HE project of
102+
their choosing.
103+
104+
If a full installation of the sample kernels, examples, and supported HE
105+
libraries is desired then build the Intel HE Toolkit container in its entirety
106+
with
107+
```bash
108+
hekit docker-build --enable samples
109+
```
97110
The installation should take a few minutes and once successful will run the
98111
container as the current user. This will be signified with the printing of the
99112
welcome message to the console.
@@ -112,11 +125,11 @@ follows
112125
hekit docker-build --id 1234
113126
```
114127

115-
After the image has been successfully built, the below message will be
116-
displayed
128+
After the image has been successfully built, the below message or a variation
129+
will be displayed
117130
```bash
118131
Run container with
119-
docker run -it <username>/ubuntu_he_toolkit:<hekit-version>
132+
docker run -it <username>/ubuntu_he_samples:<hekit-version>
120133
```
121134
Executing this command shall start the container using `bash`.
122135

@@ -127,6 +140,10 @@ of directly via the command line. To enable this run
127140
```bash
128141
hekit docker-build --enable vscode
129142
```
143+
or alternatively to include pre-built samples and examples
144+
```bash
145+
hekit docker-build --enable samples,vscode
146+
```
130147
This will build an extra layer on top of the previous images containing a VS
131148
Code configuration.
132149

@@ -196,7 +213,7 @@ The toolkit will build the images in the order that they appear in the list,
196213
i.e. `feature-three` will be built on `feature-two` which will be built on
197214
`feature-one`.
198215

199-
### Using custom base platform
216+
### Using a Custom Base Platform
200217
When building a docker image, `hekit` uses by default a version of Ubuntu as a
201218
base image that it fetches from dockerhub if it does not exist locally. This
202219
can be overridden as follows

Diff for: docker/dockerfiles.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
# `hekit docker-build --enable <custom-feature>`
44
# NOTE: Paths must be absolute
55

6+
samples = "${HEKITPATH}/docker/Dockerfile.samples"
67
vscode = "${HEKITPATH}/docker/Dockerfile.vscode"

Diff for: docker/repo-inventory.txt

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ deployments/config_psi/setenv.sh
4848
deployments/config_psi/tests/test_config_psi.py
4949
dev_reqs.txt
5050
docker/Dockerfile.base
51+
docker/Dockerfile.samples
5152
docker/Dockerfile.toolkit
5253
docker/Dockerfile.vscode
5354
docker/README.md

0 commit comments

Comments
 (0)