Skip to content

Commit

Permalink
feat: add dockerfile for sbt-1.0.4 runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
odinn1984 committed Dec 11, 2017
1 parent a7825cd commit 2d912a1
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ docker run -it
snyk/snyk-cli:mvn-3.5.2 test --org=my-org-name
```

### SBT 0.13.16
### SBT 0.13.16 / SBT 1.0.4

We will need to mount the project root folder when running the image so that Snyk can access the code within the container and mount the local .m2 and .ivy2 folders. The host project folder will be mounted to `/project` on the container and will be used to read the dependencies file and write results for CI builds. Please see the following examples on how to run Snyk inside docker:

Expand All @@ -145,6 +145,17 @@ docker run -it
snyk/snyk-cli:sbt-0.13.16 test --org=my-org-name
```

```
docker run -it
-e "SNYK_TOKEN=<TOKEN>"
-e "USER_ID=1234"
-e "MONITOR=true"
-v "<PROJECT_DIRECTORY>:/project"
-v "/home/user/.m2:/root/.m2"
-v "/home/user/.ivy2:/root/.ivy2"
snyk/snyk-cli:sbt-1.0.4 test --org=my-org-name
```

### Gradle 2.8

We will need to mount the project root folder when running the image so that Snyk can access the code within the container and mount the local .m2 and .ivy2 folders. The host project folder will be mounted to `/project` on the container and will be used to read the dependencies file and write results for CI builds. Please see the following examples on how to run Snyk inside docker:
Expand Down
46 changes: 46 additions & 0 deletions docker/Dockerfile.sbt-1.0.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM node:8-slim

MAINTAINER Snyk Ltd

# Install Java 8
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list

# Accept license non-iteractive
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
RUN apt-get update
RUN apt-get install -y oracle-java8-installer oracle-java8-set-default

#Install sbt
RUN echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list && \
apt-get install -y apt-transport-https && \
curl -L -o sbt.deb http://dl.bintray.com/sbt/debian/sbt-1.0.4.deb && \
dpkg -i sbt.deb

RUN echo "docker-user ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers && \
mkdir -p /root/.sbt/1.0/plugins && \
echo "addSbtPlugin(\"net.virtual-void\" % \"sbt-dependency-graph\" % \"0.9.0\")" >> /root/.sbt/1.0/plugins/plugins.sbt && \
echo "addCommandAlias(\"dependency-tree\", \"dependencyTree\")" >> /root/.sbt/1.0/user.sbt

# Install snyk cli
RUN npm install --global snyk snyk-to-html && \
apt-get update && \
apt-get install -y jq

# RUN chmod -R a+wrx /home/node
WORKDIR /root
ENV HOME /root
ENV M2 /root/.m2

# The path at which the project is mounted (-v runtime arg)
ENV PROJECT_PATH /project

ADD docker-entrypoint.sh .
ADD snyk_report.css .

ENTRYPOINT ["./docker-entrypoint.sh"]

# Default command is `snyk test`
# Override with `docker run ... snyk/snyk-cli <command> <args>`
CMD ["test"]

0 comments on commit 2d912a1

Please sign in to comment.