Skip to content

Commit

Permalink
Posix bits (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
beriberikix authored Dec 17, 2023
1 parent 3bbf23d commit 06ead27
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
42 changes: 41 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,44 @@ jobs:
tags: ghcr.io/${{ github.repository_owner }}/zephyr:${{ matrix.toolchain.nick }}-${{ matrix.sdk }}SDK
build-args: |
BASE_IMAGE=ghcr.io/embeddedcontainers/zephyr:base-${{ matrix.sdk }}SDK
ZEPHYR_SDK_TOOLCHAINS=-t ${{ matrix.toolchain.arch }}
ZEPHYR_SDK_TOOLCHAINS=-t ${{ matrix.toolchain.arch }}
posix:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

strategy:
matrix:
sdk: [0.16.4]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

- name: Log into GitHub Container Registry
# if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push base image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
file: ./zephyr-posix/Dockerfile
# push: ${{ github.event_name != 'pull_request' }}
push: true
platforms: linux/amd64
provenance: false
tags: ghcr.io/${{ github.repository_owner }}/zephyr:posix-${{ matrix.sdk }}SDK
build-args: |
BASE_IMAGE=ghcr.io/embeddedcontainers/zephyr:base-${{ matrix.sdk }}SDK
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ _To build an image for multiple toolchains:_

```
docker build --build-arg BASE_IMAGE="zephyr:base-0.16.4SDK" --build-arg ZEPHYR_SDK_TOOLCHAINS="-t arm-zephyr-eabi -t x86_64-zephyr-elf" -f "./zephyr/Dockerfile" -t zephyr:arm_x86-0.16.4SDK "./zephyr"
```

_There is a different Dockerfile for Posix target like `native_sim`. To build:_

```
docker build --build-arg BASE_IMAGE="zephyr:base-0.16.4SDK" -f "./zephyr-posix/Dockerfile" -t zephyr:posix-0.16.4SDK "./zephyr-posix"
```
29 changes: 29 additions & 0 deletions zephyr-posix/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG ZEPHYR_SDK_VERSION=0.16.4
ARG ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-${ZEPHYR_SDK_VERSION}
ARG BASE_IMAGE="zephyr:base-${ZEPHYR_SDK_VERSION}SDK"

FROM ${BASE_IMAGE}

# OS dependencies and packages

RUN \
apt-get -y update \
&& apt-get -y install --no-install-recommends \
gcc-multilib \
make \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Zephyr SDK

ARG ZEPHYR_SDK_INSTALL_DIR

RUN \
apt-get -y update \
&& apt-get -y install --no-install-recommends \
wget \
&& ${ZEPHYR_SDK_INSTALL_DIR}/setup.sh -c \
&& apt-get remove -y --purge \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

0 comments on commit 06ead27

Please sign in to comment.