forked from nrfconnect/sdk-nrf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add dockerfile and workflow action for releasing image
Dockerfile and Github action which builds and releases Docker image. Docker image will have Nordic toolchain bundle inside it. Signed-off-by: Kari Hamalainen <[email protected]>
- Loading branch information
1 parent
a23a23a
commit 39a730c
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
run: | | ||
TOOLCHAIN_ID=$(../print_toolchain_checksum.sh) | ||
docker build -t ghcr.io/${{ github.repository }}-toolchain:${{ github.ref_name }} --build-arg VERSION=$TOOLCHAIN_ID . | ||
docker push ghcr.io/${{ github.repository }}-toolchain:${{ github.ref_name }} | ||
working-directory: scripts/docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM ubuntu:22.04 as nrfutil-builder | ||
|
||
ARG VERSION | ||
RUN apt-get update && apt-get install -y \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN wget https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil && chmod +x nrfutil \ | ||
&& ./nrfutil install toolchain-manager && ./nrfutil toolchain-manager install --toolchain-bundle-id $VERSION | ||
RUN ./nrfutil toolchain-manager env --as-script > /root/toolchain-env.sh | ||
|
||
|
||
FROM ubuntu:22.04 | ||
|
||
# Link to repo (https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#labelling-container-images) | ||
LABEL org.opencontainers.image.source=https://github.com/nrfconnect/sdk-nrf | ||
# Set metadata for an image | ||
LABEL org.opencontainers.image.description="This image contains toolchain for sdk-nrf." | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
ca-certificates \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy toolchain | ||
COPY --from=nrfutil-builder /root/ncs/toolchains /root/ncs/toolchains | ||
COPY --from=nrfutil-builder /root/toolchain-env.sh /root/toolchain-env.sh | ||
|
||
# Add entrypoint which calls toolchain-env.sh | ||
ADD entrypoint.sh /root/entrypoint.sh | ||
ENTRYPOINT ["/root/entrypoint.sh"] | ||
CMD ["bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#! /bin/bash | ||
|
||
source /root/toolchain-env.sh | ||
exec "$@" |