From c5bba91be3a9f2166c868337dc2f72c05ba1994a Mon Sep 17 00:00:00 2001 From: JSON Date: Thu, 28 Sep 2023 10:11:17 +0100 Subject: [PATCH] revert: remove Dockerfiles for deprecated images (#4762) (#4880) This reverts commit 48da04e3e22eb5601f3cb62f001aa85602a7f408. --- docker/Dockerfile.docker | 31 +++++++++ docker/Dockerfile.gradle-2.8 | 37 +++++++++++ docker/Dockerfile.gradle-4.4 | 37 +++++++++++ docker/Dockerfile.gradle-5.4 | 37 +++++++++++ docker/Dockerfile.gradle-5.4_java11 | 36 +++++++++++ docker/Dockerfile.maven-3.5.4 | 37 +++++++++++ docker/Dockerfile.maven-3.6.3 | 37 +++++++++++ docker/Dockerfile.maven-3.6.3_java11 | 37 +++++++++++ docker/Dockerfile.npm_ruby | 30 +++++++++ docker/Dockerfile.python-2 | 34 ++++++++++ docker/Dockerfile.python-3 | 34 ++++++++++ docker/Dockerfile.python-3.6 | 34 ++++++++++ docker/Dockerfile.python-3.8 | 34 ++++++++++ docker/Dockerfile.python-3.9 | 34 ++++++++++ docker/Dockerfile.sbt-0.13.16 | 47 ++++++++++++++ docker/Dockerfile.sbt-1.0.4 | 46 ++++++++++++++ docker/README.md | 5 ++ docker/docker-entrypoint.sh | 95 ++++++++++++++++++++++++++++ docker/docker-python-entrypoint.sh | 74 ++++++++++++++++++++++ 19 files changed, 756 insertions(+) create mode 100644 docker/Dockerfile.docker create mode 100644 docker/Dockerfile.gradle-2.8 create mode 100644 docker/Dockerfile.gradle-4.4 create mode 100644 docker/Dockerfile.gradle-5.4 create mode 100644 docker/Dockerfile.gradle-5.4_java11 create mode 100644 docker/Dockerfile.maven-3.5.4 create mode 100644 docker/Dockerfile.maven-3.6.3 create mode 100644 docker/Dockerfile.maven-3.6.3_java11 create mode 100644 docker/Dockerfile.npm_ruby create mode 100644 docker/Dockerfile.python-2 create mode 100644 docker/Dockerfile.python-3 create mode 100644 docker/Dockerfile.python-3.6 create mode 100644 docker/Dockerfile.python-3.8 create mode 100644 docker/Dockerfile.python-3.9 create mode 100644 docker/Dockerfile.sbt-0.13.16 create mode 100644 docker/Dockerfile.sbt-1.0.4 create mode 100644 docker/README.md create mode 100755 docker/docker-entrypoint.sh create mode 100755 docker/docker-python-entrypoint.sh diff --git a/docker/Dockerfile.docker b/docker/Dockerfile.docker new file mode 100644 index 0000000000..522e4fb821 --- /dev/null +++ b/docker/Dockerfile.docker @@ -0,0 +1,31 @@ +FROM node:14-slim + +MAINTAINER Snyk Ltd + +# Install Docker +RUN apt-get update && \ + apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common git && \ + curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \ + add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \ + apt-get update && apt-get install -y docker-ce && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +WORKDIR /home/node +ENV HOME /home/node + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION docker + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.gradle-2.8 b/docker/Dockerfile.gradle-2.8 new file mode 100644 index 0000000000..1d8d697bd0 --- /dev/null +++ b/docker/Dockerfile.gradle-2.8 @@ -0,0 +1,37 @@ +FROM openjdk:8-jdk-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install gradle, node, cli +RUN apt-get update && \ + apt-get install -y curl unzip git && \ + curl -L https://services.gradle.org/distributions/gradle-2.8-bin.zip -o gradle-2.8-bin.zip && \ + unzip gradle-2.8-bin.zip -d /home/node/ &&\ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node +ENV M2 /home/node/.m2 +ENV GRADLE_HOME=/home/node/gradle-2.8 +ENV PATH=$PATH:$GRADLE_HOME/bin + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION gradle-2.8 + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.gradle-4.4 b/docker/Dockerfile.gradle-4.4 new file mode 100644 index 0000000000..2bdce208e5 --- /dev/null +++ b/docker/Dockerfile.gradle-4.4 @@ -0,0 +1,37 @@ +FROM openjdk:8-jdk-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install gradle, node, cli +RUN apt-get update && \ + apt-get install -y curl unzip git && \ + curl -L https://services.gradle.org/distributions/gradle-4.4-bin.zip -o gradle-4.4-bin.zip && \ + unzip gradle-4.4-bin.zip -d /home/node/ && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node +ENV M2 /home/node/.m2 +ENV GRADLE_HOME=/home/node/gradle-4.4 +ENV PATH=$PATH:$GRADLE_HOME/bin + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION gradle-4.4 + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.gradle-5.4 b/docker/Dockerfile.gradle-5.4 new file mode 100644 index 0000000000..51e787de35 --- /dev/null +++ b/docker/Dockerfile.gradle-5.4 @@ -0,0 +1,37 @@ +FROM openjdk:8-jdk-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install gradle, node, cli +RUN apt-get update && \ + apt-get install -y curl unzip git && \ + curl -L https://services.gradle.org/distributions/gradle-5.4-bin.zip -o gradle-5.4-bin.zip && \ + unzip gradle-5.4-bin.zip -d /home/node/ && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node +ENV M2 /home/node/.m2 +ENV GRADLE_HOME=/home/node/gradle-5.4 +ENV PATH=$PATH:$GRADLE_HOME/bin + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION gradle-5.4 + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.gradle-5.4_java11 b/docker/Dockerfile.gradle-5.4_java11 new file mode 100644 index 0000000000..33d4d93da2 --- /dev/null +++ b/docker/Dockerfile.gradle-5.4_java11 @@ -0,0 +1,36 @@ +FROM openjdk:11-jdk-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install gradle, node, cli +RUN apt-get update && \ + apt-get install -y curl unzip && \ + curl -L https://services.gradle.org/distributions/gradle-5.4-bin.zip -o gradle-5.4-bin.zip && \ + unzip gradle-5.4-bin.zip -d /home/node/ && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + node -v && \ + npm -v && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node +ENV M2 /home/node/.m2 +ENV GRADLE_HOME=/home/node/gradle-5.4 +ENV PATH=$PATH:$GRADLE_HOME/bin + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-entrypoint.sh . + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.maven-3.5.4 b/docker/Dockerfile.maven-3.5.4 new file mode 100644 index 0000000000..3caa37ef6d --- /dev/null +++ b/docker/Dockerfile.maven-3.5.4 @@ -0,0 +1,37 @@ +FROM openjdk:8-jdk-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install maven, node, cli +RUN apt-get update && \ + apt-get install -y curl git && \ + curl -L -o apache-maven-3.5.4-bin.tar.gz https://www-eu.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz && \ + tar -xvzf apache-maven-3.5.4-bin.tar.gz && \ + rm -f apache-maven-3.5.4-bin.tar.gz && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node +ENV M2 /home/node/.m2 +ENV PATH /home/node/apache-maven-3.5.4/bin:$PATH + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +ADD docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION maven-3.5.4 + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.maven-3.6.3 b/docker/Dockerfile.maven-3.6.3 new file mode 100644 index 0000000000..523c75b72a --- /dev/null +++ b/docker/Dockerfile.maven-3.6.3 @@ -0,0 +1,37 @@ +FROM openjdk:8-jdk-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install maven, node, cli +RUN apt-get update && \ + apt-get install -y curl git && \ + curl -L -o apache-maven-3.6.3-bin.tar.gz https://www-eu.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz && \ + tar -xvzf apache-maven-3.6.3-bin.tar.gz && \ + rm -f apache-maven-3.6.3-bin.tar.gz && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node +ENV M2 /home/node/.m2 +ENV PATH /home/node/apache-maven-3.6.3/bin:$PATH + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +ADD docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION maven-3.6.3 + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.maven-3.6.3_java11 b/docker/Dockerfile.maven-3.6.3_java11 new file mode 100644 index 0000000000..2feb14e02c --- /dev/null +++ b/docker/Dockerfile.maven-3.6.3_java11 @@ -0,0 +1,37 @@ +FROM openjdk:11-jdk-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install maven, node, cli +RUN apt-get update && \ + apt-get install -y curl git && \ + curl -L -o apache-maven-3.6.3-bin.tar.gz https://www-eu.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz && \ + tar -xvzf apache-maven-3.6.3-bin.tar.gz && \ + rm -f apache-maven-3.6.3-bin.tar.gz && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node +ENV M2 /home/node/.m2 +ENV PATH /home/node/apache-maven-3.6.3/bin:$PATH + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +ADD docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION maven-3.6.3_java11 + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.npm_ruby b/docker/Dockerfile.npm_ruby new file mode 100644 index 0000000000..4d5e92044b --- /dev/null +++ b/docker/Dockerfile.npm_ruby @@ -0,0 +1,30 @@ +FROM node:14-slim + +MAINTAINER Snyk Ltd + +WORKDIR /home/node +ENV HOME /home/node + +# Install snyk cli and clean up +RUN apt-get update && \ + apt-get install -y git && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +# This image is currently being used for nuget, composer and ruby +# If we see a tons of usage, we can split the analytics +ENV SNYK_INTEGRATION_VERSION npm + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.python-2 b/docker/Dockerfile.python-2 new file mode 100644 index 0000000000..4425e470e2 --- /dev/null +++ b/docker/Dockerfile.python-2 @@ -0,0 +1,34 @@ +FROM python:2.7-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install Python utilities, node, Snyk CLI +RUN pip install pip pipenv==2021.5.29 virtualenv -U && \ + apt-get update && \ + apt-get install -y build-essential curl git && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-python-entrypoint.sh . +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION python-2 + +ENTRYPOINT ["./docker-python-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.python-3 b/docker/Dockerfile.python-3 new file mode 100644 index 0000000000..6fe53c64b6 --- /dev/null +++ b/docker/Dockerfile.python-3 @@ -0,0 +1,34 @@ +FROM python:3.7-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install Python utilities, node, Snyk CLI +RUN pip install pip pipenv==2021.5.29 virtualenv -U && \ + apt-get update && \ + apt-get install -y build-essential curl git && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-python-entrypoint.sh . +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION python-3 + +ENTRYPOINT ["./docker-python-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.python-3.6 b/docker/Dockerfile.python-3.6 new file mode 100644 index 0000000000..3f312857ff --- /dev/null +++ b/docker/Dockerfile.python-3.6 @@ -0,0 +1,34 @@ +FROM python:3.6-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install Python utilities, node, Snyk CLI +RUN pip install pip pipenv==2021.5.29 virtualenv -U && \ + apt-get update && \ + apt-get install -y build-essential curl git && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-python-entrypoint.sh . +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION python-3.6 + +ENTRYPOINT ["./docker-python-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.python-3.8 b/docker/Dockerfile.python-3.8 new file mode 100644 index 0000000000..1797397e72 --- /dev/null +++ b/docker/Dockerfile.python-3.8 @@ -0,0 +1,34 @@ +FROM python:3.8-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install Python utilities, node, Snyk CLI +RUN pip install pip pipenv==2021.5.29 virtualenv -U && \ + apt-get update && \ + apt-get install -y build-essential curl git && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-python-entrypoint.sh . +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION python-3.8 + +ENTRYPOINT ["./docker-python-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.python-3.9 b/docker/Dockerfile.python-3.9 new file mode 100644 index 0000000000..bef2974289 --- /dev/null +++ b/docker/Dockerfile.python-3.9 @@ -0,0 +1,34 @@ +FROM python:3.9-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install Python utilities, node, Snyk CLI +RUN pip install pip pipenv==2021.5.29 virtualenv -U && \ + apt-get update && \ + apt-get install -y build-essential curl git && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-python-entrypoint.sh . +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION python-3.9 + +ENTRYPOINT ["./docker-python-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.sbt-0.13.16 b/docker/Dockerfile.sbt-0.13.16 new file mode 100644 index 0000000000..98c1d53081 --- /dev/null +++ b/docker/Dockerfile.sbt-0.13.16 @@ -0,0 +1,47 @@ +FROM openjdk:8-jdk-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install sbt, node, cli +RUN apt-get update && \ + apt-get install -y curl apt-transport-https git && \ + curl -L -o sbt-0.13.16.deb https://dl.bintray.com/sbt/debian/sbt-0.13.16.deb && \ + dpkg -i sbt-0.13.16.deb && \ + rm sbt-0.13.16.deb && \ + apt-get update && \ + apt-get install -y sbt && \ + sbt sbtVersion && \ + echo "docker-user ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers && \ + mkdir -p /root/.sbt/0.13/plugins && \ + mkdir -p /home/node/.sbt/0.13/plugins && \ + echo "addSbtPlugin(\"net.virtual-void\" % \"sbt-dependency-graph\" % \"0.8.2\")" >> /root/.sbt/0.13/plugins/build.sbt && \ + echo "addSbtPlugin(\"net.virtual-void\" % \"sbt-dependency-graph\" % \"0.8.2\")" >> /home/node/.sbt/0.13/plugins/build.sbt && \ + echo "net.virtualvoid.sbt.graph.DependencyGraphSettings.graphSettings" >> /root/.sbt/0.13/user.sbt && \ + echo "net.virtualvoid.sbt.graph.DependencyGraphSettings.graphSettings" >> /home/node/.sbt/0.13/user.sbt && \ + echo "-sbt-version 0.13.16" >> /etc/sbt/sbtopts && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node +ENV M2 /home/node/.m2 + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION sbt-0.13.16 + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/Dockerfile.sbt-1.0.4 b/docker/Dockerfile.sbt-1.0.4 new file mode 100644 index 0000000000..993d6e1757 --- /dev/null +++ b/docker/Dockerfile.sbt-1.0.4 @@ -0,0 +1,46 @@ +FROM openjdk:8-jdk-slim + +MAINTAINER Snyk Ltd + +RUN mkdir /home/node +WORKDIR /home/node + +# Install sbt, node, cli +RUN apt-get update && \ + apt-get install -y curl apt-transport-https git && \ + curl -L -o sbt-1.0.4.deb https://dl.bintray.com/sbt/debian/sbt-1.0.4.deb && \ + dpkg -i sbt-1.0.4.deb && \ + rm sbt-1.0.4.deb && \ + apt-get update && \ + apt-get install -y sbt && \ + sbt sbtVersion && \ + echo "docker-user ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers && \ + mkdir -p /root/.sbt/1.0/plugins && \ + mkdir -p /home/node/.sbt/1.0/plugins && \ + echo "addSbtPlugin(\"net.virtual-void\" % \"sbt-dependency-graph\" % \"0.9.0\")" >> /root/.sbt/1.0/plugins/plugins.sbt && \ + echo "addSbtPlugin(\"net.virtual-void\" % \"sbt-dependency-graph\" % \"0.9.0\")" >> /home/node/.sbt/1.0/plugins/plugins.sbt && \ + echo "addCommandAlias(\"dependency-tree\", \"dependencyTree\")" >> /root/.sbt/1.0/user.sbt && \ + echo "addCommandAlias(\"dependency-tree\", \"dependencyTree\")" >> /home/node/.sbt/1.0/user.sbt && \ + curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + apt-get install -y nodejs && \ + npm install --global snyk snyk-to-html && \ + apt-get autoremove -y && \ + apt-get clean && \ + chmod -R a+wrx /home/node + +ENV HOME /home/node +ENV M2 /home/node/.m2 + +# The path at which the project is mounted (-v runtime arg) +ENV PROJECT_PATH /project + +COPY docker-entrypoint.sh . + +ENV SNYK_INTEGRATION_NAME DOCKER_SNYK_CLI +ENV SNYK_INTEGRATION_VERSION sbt-1.0.4 + +ENTRYPOINT ["./docker-entrypoint.sh"] + +# Default command is `snyk test` +# Override with `docker run ... snyk/snyk-cli ` +CMD ["test"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000000..87919246d3 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,5 @@ +# Deprecation Notice + +Please note, these Docker images are deprecated and may be removed in the future. They remain available only to provide continuity for legacy Snyk integrations. **Snyk does not recommend their use.** + +Instead, please use the [`snyk/snyk`](https://hub.docker.com/r/snyk/snyk) Docker images. These images wrap the Snyk CLI and depending on the Tag come with a relevant tooling for different projects. [See the snyk/images on GitHub for more details and examples](https://github.com/snyk/snyk-images). diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh new file mode 100755 index 0000000000..6e9e258b70 --- /dev/null +++ b/docker/docker-entrypoint.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +OUTPUT_FILE=snyk-result.json +MONITOR_OUTPUT_FILE=snyk-monitor-result.json +ERROR_FILE=snyk-error.log +HTML_FILE=snyk_report.html +SNYK_COMMAND="$1" +SNYK_PARAMS="${@:2}" +ADDITIONAL_ENV="" + +if [ -z "${USER_ID}" ]; then + USER_ID=$(id -u) +fi + +USER_NAME=$(getent passwd "${USER_ID}" | awk -F ':' '{print $1}') + +if [ "${USER_NAME}" != "" ] && [ "${USER_NAME}" != "root" ]; then + usermod -d /home/node "${USER_NAME}" +fi + +useradd -o -m -u "${USER_ID}" -d /home/node docker-user 2>/dev/null + +runCmdAsDockerUser() { + su docker-user -m -c "$1" + + return $? +} + +exitWithMsg() { + echo "Failed to run the process ..." + + if [ -f "$1" ]; then + cat "$1" + else + echo "$1" + fi + + exit "$2" +} + +TEST_SETTINGS="" +PROJECT_SUBDIR="" + +if [ -n "${TARGET_FILE}" ]; then + if [ ! -f "${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}" ]; then + exitWithMsg "\"${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}\" does not exist" 2 + fi + + PROJECT_SUBDIR=$(dirname "${TARGET_FILE}") + MANIFEST_NAME=$(basename "${TARGET_FILE}") + TEST_SETTINGS="--file=${MANIFEST_NAME} " +fi + +if [ -n "${ORGANIZATION}" ]; then + TEST_SETTINGS="${TEST_SETTINGS} --org=${ORGANIZATION}" +fi + +SNYK_PARAMS="${SNYK_PARAMS} ${TEST_SETTINGS}" + +if [ -z "${SNYK_TOKEN}" ]; then + exitWithMsg "Missing \${SNYK_TOKEN}" 2 +fi + +if [ -n "${ENV_FLAGS}" ]; then + ADDITIONAL_ENV="-- ${ENV_FLAGS}" +fi + +cd "${PROJECT_PATH}/${PROJECT_FOLDER}/${PROJECT_SUBDIR}" || + exitWithMsg "Can't cd to ${PROJECT_PATH}/${PROJECT_FOLDER}/${PROJECT_SUBDIR}" 2 + +runCmdAsDockerUser "PATH=${PATH} snyk ${SNYK_COMMAND} --json ${SNYK_PARAMS} \ +${ADDITIONAL_ENV} > \"${OUTPUT_FILE}\" 2>\"${ERROR_FILE}\"" + +RC=$? + +if [ "$RC" -ne "0" ] && [ "$RC" -ne "1" ]; then + exitWithMsg "${OUTPUT_FILE}" "$RC" +fi + +runCmdAsDockerUser "touch \"${PROJECT_PATH}/${PROJECT_FOLDER}/${HTML_FILE}\"" + +if [ -n "$MONITOR" ]; then + echo "Monitoring & generating report ..." + runCmdAsDockerUser "PATH=$PATH snyk monitor --json ${SNYK_PARAMS} ${ADDITIONAL_ENV} > ${MONITOR_OUTPUT_FILE} 2>$ERROR_FILE" +fi + +runCmdAsDockerUser "cat \"${OUTPUT_FILE}\" | snyk-to-html >> \"${PROJECT_PATH}/${PROJECT_FOLDER}/${HTML_FILE}\"" + +if [ $RC -ne "0" ]; then + exitWithMsg "${OUTPUT_FILE}" "$RC" +fi + +cat "${OUTPUT_FILE}" + +exit "$RC" diff --git a/docker/docker-python-entrypoint.sh b/docker/docker-python-entrypoint.sh new file mode 100755 index 0000000000..27e4b76b67 --- /dev/null +++ b/docker/docker-python-entrypoint.sh @@ -0,0 +1,74 @@ +#!/bin/bash +virtualenv -p python snyk +source snyk/bin/activate + +exitWithMsg() { + echo "Failed to run the process ..." + + if [ -f "$1" ]; then + cat "$1" + else + echo "$1" + fi + + exit "$2" +} + +installRequirementsTxtDeps() { + echo "Installing dependencies from requirements file" + pip install -U -r "$1" +} + +installPipfileDeps() { + pushd "${PROJECT_PATH}/" + echo "Found Pipfile" + pipenv install --system --deploy + popd +} + +PROJECT_SUBDIR="" +echo "Project path = ${PROJECT_PATH}" +if [ -n "${TARGET_FILE}" ]; then + if [ ! -f "${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}" ]; then + exitWithMsg "\"${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}\" does not exist" 2 + fi + + PROJECT_SUBDIR=$(dirname "${TARGET_FILE}") + MANIFEST_NAME=$(basename "${TARGET_FILE}") + TEST_SETTINGS="--file=${MANIFEST_NAME} " + + echo "Target file = ${TARGET_FILE}" + + case $MANIFEST_NAME in + *req*.txt) + echo "Installing dependencies from requirements file" + installRequirementsTxtDeps "${PROJECT_PATH}/$MANIFEST_NAME" + ;; + *setup.py) + echo "Installing dependencies from setup.py" + pip install -U -e "${PROJECT_PATH}" + ;; + *Pipfile) + echo "Installing dependencies from Pipfile" + installPipfileDeps + ;; + *) + exitWithMsg "\"${PROJECT_PATH}/${TARGET_FILE}\" is not supported" 3 + ;; + esac +fi + +if [ -z "${TARGET_FILE}" ]; then + if [ -f "${PROJECT_PATH}/requirements.txt" ]; then + echo "Found requirement.txt" + installRequirementsTxtDeps "${PROJECT_PATH}/requirements.txt" + elif [ -f "${PROJECT_PATH}/setup.py" ]; then + echo "Found setup.py" + pip install -U -e "${PROJECT_PATH}" + elif [ -f "${PROJECT_PATH}/Pipfile" ]; then + echo "Found Pipfile" + installPipfileDeps + fi +fi + +bash docker-entrypoint.sh "$@"