> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/sast-and-sca/prezero/static-analysis-sast/workflows/docker.md).

# Docker

This article shows you how to integrate Qwiet AI by Harness into your Docker workflow to provide automated code analysis.

## Prerequisites <a href="#prerequisites" id="prerequisites"></a>

This tutorial assumes that you have:

* [Set up Docker](https://docs.docker.com/install/) for use with your application
* [Installed Qwiet AI by Harness](broken://spaces/uPVBkglG6gsk2SsnsKgG/pages/fDfomI4jhzwCNFxmGSLc)

### Authentication information <a href="#authentication-information" id="authentication-information"></a>

You must provide authentication information for Qwiet to your container via your Dockerfile. When running in a production environment, we recommend using a CI token as your access token; you can [create a CI token](/sast-and-sca/prezero/integrations/tokens.md) in the Qwiet Dashboard and provide it using the `SHIFTLEFT_ACCESS_TOKEN` environment variable.

## Integrating Qwiet AI by Harness with Docker <a href="#integrating-qwiet-ai-by-harness-with-docker" id="integrating-qwiet-ai-by-harness-with-docker"></a>

> We offer a [sample image](https://hub.docker.com/r/shiftleft/core) accompanying this article on Docker Hub, as well as an [image for devices built on ARM64 architecture](https://hub.docker.com/r/shiftleft/corearm64).

The following Dockerfile demonstrates how you can integrate Qwiet AI by Harness to scan applications written in Java, JavaScript/TypeScript, Go, and/or Python:

```
FROM ubuntu:latest as builder

ARG CLI_VERSION
ARG BUILD_DATE

ENV SHIFTLEFT_HOME=/opt/sl-cli \
    PYTHONUNBUFFERED=1 \
    DEBIAN_FRONTEND=noninteractive \
    GOPATH=/opt/app-root/go \
    GO_VERSION=1.17.8 \
    PATH=${PATH}:/opt/sl-cli:${GOPATH}/bin:/usr/local/go/bin:

LABEL maintainer="ShiftLeftSecurity" \
      org.label-schema.schema-version="1.0" \
      org.label-schema.vendor="shiftleft" \
      org.label-schema.name="scan-base" \
      org.label-schema.version=$CLI_VERSION \
      org.label-schema.license="MIT" \
      org.label-schema.description="Docker image for Qwiet Core analysis" \
      org.label-schema.url="https://www.shiftleft.io" \
      org.label-schema.usage="https://github.com/ShiftLeftSecurity/scan-base" \
      org.label-schema.build-date=$BUILD_DATE \
      org.label-schema.vcs-url="https://github.com/ShiftLeftSecurity/scan-base.git" \
      org.label-schema.docker.cmd="docker run --rm -it --name slcore shiftleft/core /bin/bash"

USER root

RUN mkdir -p /opt/sl-cli && apt update -y \
    && apt install --no-install-recommends -y jq curl wget zip unzip openjdk-8-jdk \
      build-essential python3.8 python3.8-dev python3-setuptools python3-pip python3.8-venv git maven gradle \
    && curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \
    && apt install -y nodejs \
    && curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \
    && echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list \
    && apt update && apt install -y yarn \
    && npm install -g @appthreat/cdxgen \
    && curl -LO "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" \
    && tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz \
    && rm go${GO_VERSION}.linux-amd64.tar.gz \
    && curl "https://cdn.shiftleft.io/download/sl" > /usr/local/bin/sl \
    && chmod a+rx /usr/local/bin/sl \
    && /usr/local/bin/sl update js2cpg \
    && /usr/local/bin/sl update java2cpg \
    && /usr/local/bin/sl update py2cpg \
    && /usr/local/bin/sl update go2cpg \
    && python3 -m pip install --no-cache-dir install shiftleft-scan-reports \
    && rm -rf /var/lib/apt/lists/*
```

![](/files/CRrxFX9wuboXxDrdB2dv)

![](/files/DfHDmRpYn5HJOmhRtTva) ![](/files/P5vj8JOtHNJWVEvAqKym)

**Parameters:**

| Parameter                   | Description                                                                                                                                           |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-e SHIFTLEFT_ACCESS_TOKEN` | The CI token that grants access to Qwiet resources; you can [create a CI token](/sast-and-sca/prezero/integrations/tokens.md)                         |
| `/app`                      | The directory where Qwiet should be invoked; for Java apps, provide the path to the JAR/WAR (e.g., `/app/target/helloQwiet.jar`)                      |
| `-v $PWD:/app`              | The present directory mounted inside the Docker container as `/app`                                                                                   |
| `-v /tmp:/tmp`              | The `tmp` directory; some of the Qwiet AI by Harness tools look for the `tmp` directory, and the code analysis fails if it can't locate the directory |

## Running the code analysis <a href="#running-the-code-analysis" id="running-the-code-analysis"></a>

A sample invocation of `sl analyze` looks something like the following:

{% tabs %}
{% tab title="Java" %}

```
docker run --rm -it --name slcore \
  -e SHIFTLEFT_ACCESS_TOKEN \
  -v $PWD:/app -v /tmp:/tmp \
  shiftleft/core \
  sl analyze --java --cpg /app/target/helloshiftleft.jar

# Windows users only
docker run --rm -it --name slcore \
  -e SHIFTLEFT_ACCESS_TOKEN \
  -v %cd%:/app -v /tmp:/tmp \
  shiftleft/core \
  sl analyze --java --cpg /app/target/helloshiftleft.jar
```

![](/files/DfHDmRpYn5HJOmhRtTva) ![](/files/P5vj8JOtHNJWVEvAqKym)
{% endtab %}

{% tab title="JavaScript" %}

```
docker run --rm -it --name slcore \
  -e SHIFTLEFT_ACCESS_TOKEN \
  -v $PWD:/app -v /tmp:/tmp \
  shiftleft/core \
  sl analyze --js --cpg /app

# Windows users only
docker run --rm -it --name slcore \
  -e SHIFTLEFT_ACCESS_TOKEN \
  -v %cd%:/app -v /tmp:/tmp \
  shiftleft/core \
  sl analyze --js --cpg /app
```

![](/files/DfHDmRpYn5HJOmhRtTva) ![](/files/P5vj8JOtHNJWVEvAqKym)
{% endtab %}

{% tab title="Python" %}

```
docker run --rm -it --name slcore \
  -e SHIFTLEFT_ACCESS_TOKEN \
  -v $PWD:/app -v /tmp:/tmp \
  shiftleft/core \
  sl analyze --python --cpg /app

# Windows users only
docker run --rm -it --name slcore \
  -e SHIFTLEFT_ACCESS_TOKEN \
  -v %cd%:/app -v /tmp:/tmp \
  shiftleft/core \
  sl analyze --python --cpg /app
```

![](/files/DfHDmRpYn5HJOmhRtTva) ![](/files/P5vj8JOtHNJWVEvAqKym)
{% endtab %}
{% endtabs %}
