-
Notifications
You must be signed in to change notification settings - Fork 17
Major rewrite #116
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
Major rewrite #116
Changes from all commits
5bc126e
c274807
7e1b206
e2e8d31
5a3ea62
512e1fe
933d2b2
6d88562
d2731a2
b9a32d7
c1c76ad
2aa1af0
79cf1cf
5f96834
9719d84
85906d0
2d84046
7d22e78
7b96301
4b1ee95
5125233
a788d12
96e6456
c38be2b
aa7ad4d
fdc69f5
34f659e
81012a2
9d5d506
c9f93d1
90ce00c
b943f07
eb18115
20c3f79
e759c28
879775b
904d83f
462cf24
4a0c89d
11fe56b
c682845
8cc33ab
6f47454
fae7c1d
cb3fb61
30754c5
8c8267e
86041ed
d6b9f26
a628320
292cb7f
db84c07
481a5d8
41dca3c
9ad2de1
c170854
54c86fd
7ebed6e
081b7e2
372f654
7f2c093
f1f99f4
576a914
e34c7e3
9b89a4a
492b67d
d7407f0
02efd8e
fce1b2f
62b70f9
4772f9d
e414dd8
9015d70
c8c9244
1f8c38c
d0e8d05
7db11ba
8957fca
9dd45e0
1e63f95
5847dad
da369ff
ec68f3b
0c42494
28b5cdb
883a1b9
4cb406f
326c4ee
88b82be
156545d
e5dfcb5
9204ce3
a75a15a
3dba5c6
af00831
4323197
ef23001
6a42925
06b015a
a21a2db
d2b3812
083de6f
228376a
b9d0599
6f6958a
922dc2d
4f41e7c
6ee6373
10d1bd2
4d8a6ee
653ec13
0dbebd9
808cb8d
0d550f1
48f30cd
df99533
4b168ab
661641d
1948b9c
ee91c4d
481786c
85431ab
cd64a03
3b00c10
2ac63fc
ee4ed2f
0f2e6e8
a65f7f3
d6ac58b
658ad6a
af743b1
7721391
def42ef
88f1b39
f46f91c
1a0a6f5
9208e29
b64b86b
258dca7
99bcf53
5b11de7
db5b168
ee81233
2864099
9c1331d
3e1a976
a79a53d
0ed2f96
f59131b
d6c9423
103e7fd
2d34d85
09b1c69
bf4f8e4
b8ee670
643ed61
4b48aa5
82533da
cd77bd0
8d1f08e
b069590
be670af
cf92be1
e7a9254
bcbbed7
58492af
5dfe6f8
01133c6
394e1bd
81504dd
1e0964e
1562a0f
177cc2d
4d634ce
b70ab83
c3d0aa8
beb3a24
5164aaa
6f8ab94
f011548
b4542f2
bd71979
3c34d56
8015413
4612f17
e256c05
764b220
50aaacc
4fd7869
2de10b7
28e538b
c159d89
360f9af
433c5e9
868b811
6db0460
561c63f
abf7588
3109fee
b6b5f48
6102907
c48aaec
289769a
9cbe4ee
bd82cc9
33ab86e
de251e2
dab66db
b658dff
221ed57
e1316e6
f36334f
b231009
1b20d4c
22bba56
bfdebed
59915dd
de528ec
508c53b
a8c8750
33d5420
2f5d1d4
f544c62
611616c
8c14191
f760634
ec08a35
b0063e3
cd12c6a
860c94b
a1c5ffe
1d06b9f
0628ac3
42243b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # @copyright Copyright (c) contributors to Project Ocre, | ||
| # which has been established as Project Ocre a Series of LF Projects, LLC | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| FROM ubuntu:24.04 AS ocre-ci | ||
|
|
||
| ARG USERNAME=ocre-dev | ||
| ARG USER_UID=1000 | ||
| ARG USER_GID=$USER_UID | ||
|
|
||
| ARG NODE_MAJOR=20 | ||
| ARG WASI_SDK_VERSION=29 | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| ca-certificates \ | ||
| curl \ | ||
| gcc \ | ||
| git \ | ||
| gpg \ | ||
| make \ | ||
| build-essential \ | ||
| cmake \ | ||
| cppcheck \ | ||
| clang \ | ||
| clang-format \ | ||
| clang-tools \ | ||
| libclang-rt-dev \ | ||
| llvm \ | ||
| net-tools \ | ||
| sudo \ | ||
| jq \ | ||
| && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ | ||
| echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \ | ||
| apt-get update && apt-get install -y --no-install-recommends \ | ||
| nodejs \ | ||
| && apt-get clean -y\ | ||
| && update-alternatives --install /usr/bin/python python /usr/bin/python3 50 | ||
|
|
||
| # Install wasi-sdk | ||
| RUN mkdir /opt/wasi-sdk && \ | ||
| curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-$(uname -m | sed s/aarch64/arm64/)-linux.tar.gz | \ | ||
| tar zxvf - --strip-components=1 -C /opt/wasi-sdk | ||
|
|
||
| FROM ocre-ci AS ocre-dev | ||
|
|
||
| # Accomodate the user for devcontainer | ||
| RUN (userdel -r $USERNAME ; userdel -r `id -nu $USER_UID` ; groupdel `id -ng $USER_GID`) || true \ | ||
| && groupadd --gid $USER_GID $USERNAME \ | ||
| && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \ | ||
| && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
| && chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
|
||
| USER $USERNAME | ||
|
|
||
| WORKDIR /home/$USERNAME | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "build": { | ||
| "dockerfile": "Dockerfile", | ||
| "args": { | ||
| "USERNAME": "${localEnv:USER}", | ||
| "USER_UID": "${localEnv:REMOTE_UID:1000}", | ||
| "USER_GID": "${localEnv:REMOTE_GID:1000}" | ||
| } | ||
| }, | ||
| "remoteUser": "${localEnv:USER}" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # @copyright Copyright (c) contributors to Project Ocre, | ||
| # which has been established as Project Ocre a Series of LF Projects, LLC | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| FROM ubuntu:24.04 AS base | ||
|
|
||
| ARG USERNAME=ocre-dev | ||
| ARG USER_UID=1000 | ||
| ARG USER_GID=$USER_UID | ||
|
|
||
| ARG NODE_MAJOR=20 | ||
| ARG WASI_SDK_VERSION=29 | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| ca-certificates \ | ||
| ccache \ | ||
| clang \ | ||
| clang-format \ | ||
| clang-tools \ | ||
| cmake \ | ||
| cppcheck \ | ||
| curl \ | ||
| device-tree-compiler \ | ||
| dfu-util \ | ||
| file \ | ||
| gcc \ | ||
| git \ | ||
| gperf \ | ||
| gpg \ | ||
| jq \ | ||
| libmagic1 \ | ||
| libsdl2-dev \ | ||
| llvm \ | ||
| make \ | ||
| net-tools \ | ||
| ninja-build \ | ||
| python3-dev \ | ||
| python3-venv \ | ||
| python3-tk \ | ||
| sudo \ | ||
| wget \ | ||
| xz-utils \ | ||
| && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ | ||
| echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \ | ||
| apt-get update && apt-get install -y --no-install-recommends \ | ||
| nodejs \ | ||
| && apt-get clean -y\ | ||
| && update-alternatives --install /usr/bin/python python /usr/bin/python3 50 | ||
|
|
||
| # Install wasi-sdk | ||
| RUN mkdir /opt/wasi-sdk && \ | ||
| curl -sSL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-$(uname -m | sed s/aarch64/arm64/)-linux.tar.gz | \ | ||
| tar zxvf - --strip-components=1 -C /opt/wasi-sdk | ||
|
|
||
| RUN python -m venv /opt/zephyr-venv && \ | ||
| . /opt/zephyr-venv/bin/activate && \ | ||
| pip install \ | ||
| west \ | ||
| littlefs-python | ||
|
|
||
| # Install the SDK on a separate stage to avoid layer cluttering | ||
|
|
||
| FROM base AS zephyr-sdk | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably you need many things in the same container, but you could use some of the zephyr's container images like ghcr.io/zephyrproject-rtos/zephyr-build
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The zephyr containers are massive as they include all other toolchains and even more unnecessary stuff. I tried to keep this container as thin as possible, unfortunately it is still very big (but small enough to work on GH public runners). So this worked as a solution to use very similar images in devcontainer and GH workflows.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| RUN mkdir -p /tmp/zephyrproject/ocre-runtime | ||
|
|
||
| COPY west.yml /tmp/zephyrproject/ocre-runtime/west.yml | ||
|
|
||
| RUN . /opt/zephyr-venv/bin/activate && \ | ||
| cd /tmp/zephyrproject && \ | ||
| west init -l ocre-runtime && \ | ||
| west update -n zephyr && \ | ||
| west packages pip --install && \ | ||
| west sdk install --install-base /opt -t \ | ||
| x86_64-zephyr-elf \ | ||
| aarch64-zephyr-elf \ | ||
| arm-zephyr-eabi | ||
|
|
||
| FROM base AS ocre-ci | ||
|
|
||
| COPY --from=zephyr-sdk /opt/. /opt | ||
|
|
||
| RUN printf "\n%s\n" '. /opt/zephyr-venv/bin/activate' >> /etc/skel/.bashrc | ||
|
|
||
| FROM ocre-ci AS ocre-dev | ||
|
|
||
| # Accomodate the user for devcontainer | ||
| RUN (userdel -r $USERNAME ; userdel -r `id -nu $USER_UID` ; groupdel `id -ng $USER_GID`) || true \ | ||
| && groupadd --gid $USER_GID $USERNAME \ | ||
| && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \ | ||
| && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
| && chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
|
||
| USER $USERNAME | ||
|
|
||
| WORKDIR /home/$USERNAME | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "build": { | ||
| "dockerfile": "Dockerfile", | ||
| "context": "../..", | ||
| "args": { | ||
| "USERNAME": "${localEnv:USER}", | ||
| "USER_UID": "${localEnv:REMOTE_UID:1000}", | ||
| "USER_GID": "${localEnv:REMOTE_GID:1000}" | ||
| } | ||
| }, | ||
| "remoteUser": "${localEnv:USER}", | ||
| "postCreateCommand": "sudo chown ${localEnv:USER} .." | ||
|
|
||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's also a wasi-sdk container that could be used as a base:
ghcr.io/webassembly/wasi-sdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WASI SDK container is the SDK for building Wasm binaries not for building native binaries (though the compiler can output native code as well). It also changes fairly regularly. IMHO, we need to control the version of the toolchain we're using for builds more explicitly.