Skip to content

Commit

Permalink
llvm image (#6)
Browse files Browse the repository at this point in the history
* llvm image

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>

* Remove unused config

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>

* Specify ninja jobs count

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>

---------

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu authored May 12, 2024
1 parent 7f75971 commit 79d8d18
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 3 deletions.
42 changes: 40 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ jobs:
file: cdxgen/Dockerfile.java
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/appthreat/cdxgen-java:latest,ghcr.io/appthreat/cdxgen-java:v10
tags: ghcr.io/appthreat/cdxgen-java:latest,ghcr.io/appthreat/cdxgen-java:v10,ghcr.io/appthreat/cdxgen-java11:latest,ghcr.io/appthreat/cdxgen-java11:v10
labels: ${{ steps.meta-cdxgen-java.outputs.labels }}

sle-java17-image:
Expand Down Expand Up @@ -388,7 +388,7 @@ jobs:
file: cdxgen/Dockerfile.python
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/appthreat/cdxgen-python:latest,ghcr.io/appthreat/cdxgen-python:v10
tags: ghcr.io/appthreat/cdxgen-python:latest,ghcr.io/appthreat/cdxgen-python:v10,ghcr.io/appthreat/cdxgen-python312:latest,ghcr.io/appthreat/cdxgen-python312:v10
labels: ${{ steps.meta-cdxgen-python.outputs.labels }}

sle-python311-image:
Expand Down Expand Up @@ -501,3 +501,41 @@ jobs:
push: true
tags: ${{ steps.meta-opensuse-lang.outputs.tags }}
labels: ${{ steps.meta-opensuse-lang.outputs.labels }}

sle-llvm-image:
runs-on: [self-hosted, almalinux]
timeout-minutes: 3600
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta-bci-llvm
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/appthreat/bci-llvm
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
file: sle/Dockerfile.llvm
platforms: linux/amd64
push: true
tags: ${{ steps.meta-bci-llvm.outputs.tags }}
labels: ${{ steps.meta-bci-llvm.outputs.labels }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Example invocations:
Java 11 version

```shell
docker run --rm -v /tmp:/tmp -v $HOME/.m2:$HOME/.m2 -v $(pwd):/app:rw -t ghcr.io/appthreat/cdxgen-java:v10 -r /app -o /app/bom.json -t java
docker run --rm -v /tmp:/tmp -v $HOME/.m2:$HOME/.m2 -v $(pwd):/app:rw -t ghcr.io/appthreat/cdxgen-java11:v10 -r /app -o /app/bom.json -t java
```

Java 17 version
Expand Down
54 changes: 54 additions & 0 deletions sle/Dockerfile.llvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM registry.suse.com/bci/rust:1.77 as builder

ARG GCC_VERSION=13
ARG NODE_VERSION=22.1.0
ARG LLVM_VERSION=17.0.6

ENV LC_ALL=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
NVM_DIR="/root/.nvm" \
LLVM_HOME=/opt/llvm/llvm-project-${LLVM_VERSION}.src/release-build/bin \
CMAKE_CXX_COMPILER=/usr/bin/g++
ENV PATH=$PATH:${LLVM_HOME}:/root/.nvm/versions/node/v${NODE_VERSION}/bin:

RUN set -e; \
ARCH_NAME="$(rpm --eval '%{_arch}')"; \
url=; \
case "${ARCH_NAME##*-}" in \
'x86_64') \
OS_ARCH_SUFFIX=''; \
GOBIN_VERSION='amd64'; \
;; \
'aarch64') \
OS_ARCH_SUFFIX='-aarch64'; \
GOBIN_VERSION='arm64'; \
;; \
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
esac; \
zypper refresh && zypper --non-interactive update && zypper --non-interactive install -l --no-recommends gcc${GCC_VERSION} gcc${GCC_VERSION}-c++ gcc${GCC_VERSION}-fortran \
ninja git-core wget zip unzip make gawk cmake bison xz python311 python311-pip python311-devel valgrind-devel \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 10 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 10 \
&& update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_VERSION} 10 \
&& mkdir /opt/llvm && cd /opt/llvm \
&& curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz \
&& tar Jxf llvm-project-${LLVM_VERSION}.src.tar.xz \
&& cd /opt/llvm/llvm-project-${LLVM_VERSION}.src \
&& cmake -S llvm -B ./release-build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_DUMP=ON -DLLVM_ENABLE_FFI=ON \
-DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld;clang-tools-extra" \
-DLLVM_DISTRIBUTION_COMPONENTS="lld;compiler-rt;clang-format" \
-DCLANG_DEFAULT_LINKER="lld" \
&& ninja -C ./release-build -j 8 \
&& rm /opt/llvm/llvm-project-${LLVM_VERSION}.src.tar.xz \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
&& source /root/.nvm/nvm.sh \
&& nvm install ${NODE_VERSION} \
&& node -v \
&& npm -v \
&& gcc --version \
&& rustc --version \
&& zypper clean -a

CMD /bin/bash

0 comments on commit 79d8d18

Please sign in to comment.