Skip to content

Commit

Permalink
Merge pull request #97 from ossf/powertobash
Browse files Browse the repository at this point in the history
Resolving build issues with powershell and M1 Apple Chip capability
  • Loading branch information
Cyber-JiuJiteria authored Jan 4, 2023
2 parents 9e015cc + 933ac49 commit 50f93dc
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 7 deletions.
3 changes: 3 additions & 0 deletions omega/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions omega/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions omega/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions omega/.idea/omega.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions omega/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions omega/analyzer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM mcr.microsoft.com/mirror/docker/library/ubuntu:22.04

# Copyright (C) Microsoft Corporation, All rights reserved.

LABEL schema-version="1.0"
Expand All @@ -16,10 +15,11 @@ ARG OSSGADGET_VERSION="0.1.365"
ARG GO_VERSION="1.19.3"
ARG BRAKEMAN_VERSION="v5.4.0"
ARG SCC_VERSION="3.0.0"
ARG NODE_VERSION="18.x"
ARG NODE_VERSION="19.x"
ARG DEVSKIM_VERSION="0.8.4-alpha"
ARG RADARE2_VERSION="5.7.8"
ARG CODEQL_VERSION="v2.11.4"
ARG CODEQL_VERSION="v2.11.6"
ARG UBUNTU_VERSION="22.04"

# Initialize some things
ARG DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -114,8 +114,8 @@ RUN apt-get update && \
# License: https://github.com/dotnet/core/blob/main/LICENSE.TXT
# License: https://github.com/PowerShell/PowerShell/blob/master/LICENSE.txt
# Workaround with /etc/apt/preferences based on https://github.com/dotnet/core/issues/7699
RUN cd /tmp && \
wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
RUN cd /tmp
RUN wget -q -a -O https://packages.microsoft.com/config/ubuntu/${UBUNTU_VERSION}/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
rm packages-microsoft-prod.deb && \
touch /etc/apt/preferences && \
Expand All @@ -124,8 +124,10 @@ RUN cd /tmp && \
echo "Pin-Priority: 1001" >> /etc/apt/preferences && \
add-apt-repository universe && \
apt update && \
apt-get install -y dotnet-sdk-${DOTNET_VERSION} && \
apt-get install -y powershell
apt-get install -y dotnet-sdk-${DOTNET_VERSION}

# TODO remove once determined it is no longer needed
# apt-get install -y powershell

# Install Go
# License: https://github.com/golang/go/blob/master/LICENSE
Expand Down
24 changes: 24 additions & 0 deletions omega/analyzer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ hardware.

We're exploring making the pre-built image available.

### Troubleshooting steps

#### MacOS M1 Chip
If using a Mac OSX with the latest Docker Desktop (4.15 as of writing), `docker build build.ps1` will shoot out several error messages.

Make sure to create `/etc/apt/` with sudo user

Download and install
* `wget` with `brew install wget`
* `dkpg` with `brew install dpkg`
* .NET core with `brew install mono-libgdiplus`

There is a known issue with [M1 Apple chip on MacOS](https://stackoverflow.com/questions/71040681/qemu-x86-64-could-not-open-lib64-ld-linux-x86-64-so-2-no-such-file-or-direc), which would produce the error when running

```qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory```

The following two options are available to work around this issue:
1. Set the DOCKER_DEFAULT_PLATFORM environment variable to linux/amd64

`export DOCKER_DEFAULT_PLATFORM=linux/amd64`
2. In the FROM section of the Dockerfile, line 1, modify to the following

`FROM --platform=linux/amd64 mcr.microsoft.com/mirror/docker/library/ubuntu:22.04`

## Running

To run the image, navigate to the `worker` directory and run the `run-analysis.ps1`
Expand Down

0 comments on commit 50f93dc

Please sign in to comment.