forked from microsoft/codeql-container
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
94 lines (81 loc) · 3.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
FROM ubuntu:20.04 AS codeql_base
LABEL maintainer="Github codeql team"
# tzdata install needs to be non-interactive
ENV DEBIAN_FRONTEND=noninteractive
# install/update basics and python
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
software-properties-common \
vim \
curl \
wget \
git \
build-essential \
unzip \
apt-transport-https \
python3.8 \
python3-venv \
python3-pip \
python3-setuptools \
python3-dev \
gnupg \
g++ \
make \
gcc \
apt-utils \
rsync \
file \
dos2unix \
gettext && \
apt-get clean && \
ln -s /usr/bin/python3.8 /usr/bin/python && \
ln -s /usr/bin/pip3 /usr/bin/pip
# Install .NET Core tools/builds
RUN cd /tmp && \
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update; \
apt-get install -y apt-transport-https && \
apt-get update && \
rm packages-microsoft-prod.deb
RUN apt-get install -y dotnet-sdk-3.1
# Install Java and maven
RUN apt-get install -y default-jdk && \
apt-get install maven -y
# Install gradle
RUN cd /tmp && \
wget https://services.gradle.org/distributions/gradle-6.8.2-bin.zip && \
unzip -d /opt/gradle /tmp/gradle-*.zip
ENV GRADLE_HOME=/opt/gradle/gradle-6.8.2
ENV PATH=${GRADLE_HOME}/bin:${PATH}
# Clone our setup and run scripts
#RUN git clone https://github.com/microsoft/codeql-container /usr/local/startup_scripts
RUN mkdir -p /usr/local/startup_scripts
RUN ls -al /usr/local/startup_scripts
COPY container /usr/local/startup_scripts/
RUN pip3 install --upgrade pip \
&& pip3 install -r /usr/local/startup_scripts/requirements.txt
# Install latest codeQL
ENV CODEQL_HOME /usr/local/codeql-home
# record the latest version of the codeql-cli
RUN python3 /usr/local/startup_scripts/get-latest-codeql-version.py > /tmp/codeql_version
RUN mkdir -p ${CODEQL_HOME} \
${CODEQL_HOME}/codeql-repo \
${CODEQL_HOME}/codeql-go-repo \
/opt/codeql
# get the latest codeql queries and record the HEAD
RUN git clone https://github.com/github/codeql ${CODEQL_HOME}/codeql-repo && \
git --git-dir ${CODEQL_HOME}/codeql-repo/.git log --pretty=reference -1 > /opt/codeql/codeql-repo-last-commit
RUN git clone https://github.com/github/codeql-go ${CODEQL_HOME}/codeql-go-repo && \
git --git-dir ${CODEQL_HOME}/codeql-go-repo/.git log --pretty=reference -1 > /opt/codeql/codeql-go-repo-last-commit
RUN CODEQL_VERSION=$(cat /tmp/codeql_version) && \
wget -q https://github.com/github/codeql-cli-binaries/releases/download/${CODEQL_VERSION}/codeql-linux64.zip -O /tmp/codeql_linux.zip && \
unzip /tmp/codeql_linux.zip -d ${CODEQL_HOME} && \
rm /tmp/codeql_linux.zip
ENV PATH="${CODEQL_HOME}/codeql:${PATH}"
# Pre-compile our queries to save time later
RUN codeql query compile --threads=0 ${CODEQL_HOME}/codeql-repo/*/ql/src/codeql-suites/*.qls
RUN codeql query compile --threads=0 ${CODEQL_HOME}/codeql-go-repo/ql/src/codeql-suites/*.qls
ENV PYTHONIOENCODING=utf-8
ENTRYPOINT ["python3", "/usr/local/startup_scripts/startup.py"]