Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move HE samples to separate docker layer #190

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docker/Dockerfile.samples
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

ARG CUSTOM_FROM

FROM $CUSTOM_FROM

LABEL maintainer="https://github.com/intel/he-toolkit"

# User setup
ARG UNAME
ARG UID
ARG GID
ARG HOME="/home/$UNAME"
ENV SHELL="/bin/bash"

# Switch user to $UNAME
USER $UNAME

# Change directories to $HOME/he-toolkit
WORKDIR $HOME/he-toolkit

# Build and install libraries, examples, and kernels
RUN ./hekit install recipes/default.toml && \
./hekit build recipes/examples.toml --recipe_arg "toolkit-path=${HOME}/he-toolkit" && \
./hekit build recipes/sample-kernels.toml --recipe_arg "toolkit-path=${HOME}/he-toolkit"

ENTRYPOINT . docker/runners.sh && welcome_message && cd $HOME && /bin/bash
5 changes: 1 addition & 4 deletions docker/Dockerfile.toolkit
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ RUN ["pip", "install", "toml", "argcomplete"]
WORKDIR $HOME/he-toolkit

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

ENTRYPOINT . docker/runners.sh && welcome_message && cd $HOME && /bin/bash
1 change: 0 additions & 1 deletion docker/Dockerfile.vscode
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ RUN for e in vscode.cpp twxs.cmake ms-vscode.cmake-tools vadimcn.vscode-lldb; do
code-server --user-data-dir=$HOME/ --install-extension $e; \
done


# Update code-server user settings
RUN echo '{"extensions.autoUpdate": false, "workbench.colorTheme": "Default Dark+"}' |\
jq . > $HOME/User/settings.json && \
Expand Down
27 changes: 22 additions & 5 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [Steps](#steps)
- [Using VS Code Server](#using-vs-code-server)
- [Using Custom Dockerfiles](#using-custom-dockerfiles)
- [Using a Custom Base Platform](#using-a-custom-base-platform)
- [Running the Examples](#running-the-examples)
- [Docker Controls](#docker-controls)
- [Commands used inside the Docker Container](#commands-used-inside-the-docker-container)
Expand Down Expand Up @@ -90,10 +91,22 @@ on `Apply & Restart`.
memory. This can be done via the `Resources` tab under `Preferences`.

### Steps
To build and run the Intel HE Toolkit container run
To build the base docker container run
```bash
hekit docker-build
```
This will build a base image containing the necessary dependencies and then an
image containing the HE Toolkit repository with the `hekit` command enabled.
This can be useful as a base for users to use the HE Toolkit to build a subset
of the provided sample kernels and examples or an entirely custom HE project of
their choosing.

If a full installation of the sample kernels, examples, and supported HE
libraries is desired then build the Intel HE Toolkit container in its entirety
with
```bash
hekit docker-build --enable samples
```
The installation should take a few minutes and once successful will run the
container as the current user. This will be signified with the printing of the
welcome message to the console.
Expand All @@ -112,11 +125,11 @@ follows
hekit docker-build --id 1234
```

After the image has been successfully built, the below message will be
displayed
After the image has been successfully built, the below message or a variation
will be displayed
```bash
Run container with
docker run -it <username>/ubuntu_he_toolkit:<hekit-version>
docker run -it <username>/ubuntu_he_samples:<hekit-version>
```
Executing this command shall start the container using `bash`.

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

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

### Using custom base platform
### Using a Custom Base Platform
When building a docker image, `hekit` uses by default a version of Ubuntu as a
base image that it fetches from dockerhub if it does not exist locally. This
can be overridden as follows
Expand Down
1 change: 1 addition & 0 deletions docker/dockerfiles.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
# `hekit docker-build --enable <custom-feature>`
# NOTE: Paths must be absolute

samples = "${HEKITPATH}/docker/Dockerfile.samples"
vscode = "${HEKITPATH}/docker/Dockerfile.vscode"
1 change: 1 addition & 0 deletions docker/repo-inventory.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ deployments/config_psi/setenv.sh
deployments/config_psi/tests/test_config_psi.py
dev_reqs.txt
docker/Dockerfile.base
docker/Dockerfile.samples
docker/Dockerfile.toolkit
docker/Dockerfile.vscode
docker/README.md
Expand Down
Loading