-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.dev
146 lines (120 loc) · 4.08 KB
/
Dockerfile.dev
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c) 2023. University of Texas at Austin. All rights reserved.
ARG BUILD_IMAGE=ubuntu:22.04
# Sonar image
FROM --platform=linux/amd64 ubuntu:22.04 AS sonar
RUN apt-get update && \
apt-get install -y \
curl \
unzip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
ENV SONAR_SCANNER_VERSION=5.0.0.2966
RUN mkdir -p /tmp/sonar \
&& curl -sSLo /tmp/sonar/scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip \
&& unzip -o /tmp/sonar/scanner.zip -d /usr/local/ \
&& rm -rf /tmp/sonar
RUN for exe in /usr/local/sonar-scanner-${SONAR_SCANNER_VERSION}-linux/bin/*; do ln -s ${exe} /usr/local/bin/$(basename "${exe}"); done
ARG VERSION
ARG SONAR_ADDRESS
ENV SONAR_ADDRESS=${SONAR_ADDRESS}
ENV VERSION=${VERSION}
WORKDIR /sonar
RUN echo "sonar-scanner -Dsonar.host.url=$SONAR_ADDRESS -Dsonar.projectVersion=$VERSION" > sonar.sh
CMD ["bash", "/sonar/sonar.sh"]
# Base ci image
FROM --platform=linux/amd64 ${BUILD_IMAGE} AS dev
ARG COMPILER=g++-12
ARG GCC_VERSION=12.3.0
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt install -y \
${COMPILER}=${GCC_VERSION}* \
ccache \
build-essential \
make \
libboost-all-dev \
libfmt-dev \
lsb-release \
wget \
software-properties-common \
gnupg \
gdb \
vim \
git \
shfmt \
language-pack-en \
python3 \
python3-pip \
libfmt-dev \
libzstd-dev \
unzip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
COPY --from=sonar /usr/local/sonar-scanner-*-linux /usr/local/sonar-scanner-linux
RUN for exe in /usr/local/sonar-scanner-linux/bin/*; do ln -s ${exe} /usr/local/bin/$(basename "${exe}"); done
COPY --from=sonar /sonar/sonar.sh /sonar/sonar.sh
# CMake and build optimization packages
RUN apt-get update -y \
&& apt install -y ca-certificates gpg wget \
&& wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \
&& echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null \
&& apt-get update -y \
&& rm /usr/share/keyrings/kitware-archive-keyring.gpg \
&& apt-get install -y kitware-archive-keyring \
&& apt-get update -y \
&& apt-get install -y cmake cmake-curses-gui \
&& apt-get purge -y gpg \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ENV NINJA_BUILD_VERSION=1.11.1
RUN wget https://github.com/ninja-build/ninja/releases/download/v${NINJA_BUILD_VERSION}/ninja-linux.zip -P /tmp && \
unzip /tmp/ninja-linux.zip -d /usr/bin && \
rm /tmp/ninja-linux.zip
ARG IS_CI=true
RUN if [ "${IS_CI}" != "true" ] ; then \
apt update -y \
&& apt install -y \
vim \
gdb \
universal-ctags \
powerline \
zsh \
valgrind \
sudo \
doxygen \
texlive-latex-extra \
texlive-font-utils \
gcovr \
&& apt clean \
&& update-locale; fi
ARG SRC_DIR=/galois
ARG BUILD_DIR=/galois/build
ARG UNAME
ARG UID
ARG GID
RUN if [ "${UNAME}" != "root" ] ; then groupadd -g ${GID} ${UNAME} \
&& useradd -ms /bin/bash -u "${UID}" -g "${GID}" ${UNAME} ; fi
RUN mkdir -p /home/${UNAME} \
&& chown ${UNAME}:${UNAME} /home/${UNAME}
USER ${UNAME}
WORKDIR /home/${UNAME}
ENV BUILD_DIR=${BUILD_DIR}
RUN pip3 install compdb pre-commit cpplint "clang-format>=14.0.0,<17.0.0"
RUN echo "export SRC_DIR=${SRC_DIR}" >> /home/${UNAME}/.profile
RUN echo "export BUILD_DIR=${BUILD_DIR}" >> /home/${UNAME}/.profile
RUN echo "touch ${SRC_DIR}/env-docker.sh" >> /home/${UNAME}/.profile
RUN echo "source ${SRC_DIR}/env-docker.sh" >> /home/${UNAME}/.profile
RUN echo "PATH=/home/${UNAME}/.local/bin/:\$PATH" >> /home/${UNAME}/.zshenv
WORKDIR ${SRC_DIR}
ENV GCC_VERSION=${GCC_VERSION}
ENV TERM=xterm-256color
ENV USER=${UNAME}
ENV LANG="C.UTF-8"
ENV LC_COLLATE="C.UTF-8"
ENV LC_CTYPE="C.UTF-8"
ENV LC_MESSAGES="C.UTF-8"
ENV LC_MONETARY="C.UTF-8"
ENV LC_NUMERIC="C.UTF-8"
ENV LC_TIME="C.UTF-8"
USER ${UNAME}