1+ FROM ubuntu:20.04 AS codeql_base
2+ LABEL maintainer="Github codeql team"
3+
4+ # tzdata install needs to be non-interactive
5+ ENV DEBIAN_FRONTEND=noninteractive
6+
7+ # install/update basics and python
8+ RUN apt-get update && \
9+ apt-get upgrade -y && \
10+ apt-get install -y --no-install-recommends \
11+ software-properties-common \
12+ vim \
13+ curl \
14+ wget \
15+ git \
16+ jq \
17+ build-essential \
18+ unzip \
19+ apt-transport-https \
20+ python3.8 \
21+ python3-venv \
22+ python3-pip \
23+ python3-setuptools \
24+ python3-dev \
25+ gnupg \
26+ g++ \
27+ make \
28+ gcc \
29+ apt-utils \
30+ rsync \
31+ file \
32+ dos2unix \
33+ default-jdk \
34+ gettext && \
35+ apt-get clean && \
36+ ln -s /usr/bin/python3.8 /usr/bin/python && \
37+ ln -s /usr/bin/pip3 /usr/bin/pip
38+
39+ # Install Golang
40+ RUN wget -q -O - https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh | bash
41+
42+ # Install latest codeQL
43+ ENV CODEQL_HOME /opt/codeql-home
44+
45+ # Get CodeQL verion
46+ RUN curl --silent "https://api.github.com/repos/github/codeql-cli-binaries/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1 /' > /tmp/codeql_version
47+
48+ # record the latest version of the codeql-cli
49+ RUN mkdir -p ${CODEQL_HOME} \
50+ ${CODEQL_HOME}/codeql-repo \
51+ ${CODEQL_HOME}/codeql-go-repo \
52+ /opt/codeql
53+
54+ # get the latest codeql queries and record the HEAD
55+ RUN git clone https://github.com/github/codeql ${CODEQL_HOME}/codeql-repo && \
56+ git --git-dir ${CODEQL_HOME}/codeql-repo/.git log --pretty=reference -1 > /opt/codeql/codeql-repo-last-commit
57+ RUN git clone https://github.com/github/codeql-go ${CODEQL_HOME}/codeql-go-repo && \
58+ git --git-dir ${CODEQL_HOME}/codeql-go-repo/.git log --pretty=reference -1 > /opt/codeql/codeql-go-repo-last-commit
59+
60+ RUN CODEQL_VERSION=$(cat /tmp/codeql_version) && \
61+ wget -q https://github.com/github/codeql-cli-binaries/releases/download/${CODEQL_VERSION}/codeql-linux64.zip -O /tmp/codeql_linux.zip && \
62+ unzip /tmp/codeql_linux.zip -d ${CODEQL_HOME} && \
63+ rm /tmp/codeql_linux.zip
64+
65+ ENV PATH="${CODEQL_HOME}/codeql:${PATH}"
66+
67+ # # Pre-compile our queries to save time later
68+ # RUN codeql query compile --threads=0 ${CODEQL_HOME}/codeql-repo/*/ql/src/codeql-suites/*.qls
69+ # RUN codeql query compile --threads=0 ${CODEQL_HOME}/codeql-go-repo/ql/src/codeql-suites/*.qls
70+
71+ ENTRYPOINT /bin/bash
72+ # ENV PYTHONIOENCODING=utf-8
73+ # ENTRYPOINT ["python3", "/usr/local/startup_scripts/startup.py"]
0 commit comments