Skip to content

Commit

Permalink
docker: add dockerfile and CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
acki-m committed Aug 10, 2021
1 parent d3d841f commit 5bc5f50
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/docker_hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI to Docker Hub

on:
push:
branches:
- 'master'

jobs:

build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
-
name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
-
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: rttr/docker-ci:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
106 changes: 106 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
FROM ubuntu:latest

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial main" && \
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial universe" && \
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial-updates main" && \
apt-add-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe" && \
apt-get update && \
apt-get install -y --no-install-recommends \
git ninja-build make doxygen graphviz unzip iwyu libboost-all-dev valgrind vera++ \
lsb-release wget clang-format clang-tools-11 clang-tidy-11 lcov gpg-agent \
g++-4.8 g++-4.9 g++-5 g++-7 g++-8 g++-9 g++-10 g++ \
clang-3.5 clang-3.6 clang-3.7 clang-3.8 clang-3.9 clang-4.0 clang-5.0 clang-6.0 clang-7 clang-8 clang-9 clang-10 clang-11 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

#######################################################################################
# CMake
#######################################################################################

RUN CMAKE_VERSION=3.21.1 && \
wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.sh && \
chmod a+x cmake-$CMAKE_VERSION-Linux-x86_64.sh && \
./cmake-$CMAKE_VERSION-Linux-x86_64.sh --skip-license --prefix=/usr/local && \
rm cmake-$CMAKE_VERSION-Linux-x86_64.sh

#######################################################################################
# GCC
#######################################################################################

RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt-get update && \
apt-get install -y g++-11 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

#######################################################################################
# Clang
#######################################################################################

RUN wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 12 && rm llvm.sh

#######################################################################################
# CppCheck
#######################################################################################

RUN git clone --depth 1 https://github.com/danmar/cppcheck.git && \
cmake -S cppcheck -B cppcheck/build -G Ninja -DCMAKE_BUILD_TYPE=Release && \
cmake --build cppcheck/build --target install && \
rm -fr cppcheck

#######################################################################################
# PVS Studio
#######################################################################################

# see https://www.viva64.com/en/m/0039/#IDA60A8D2301
RUN wget -q -O - https://files.viva64.com/etc/pubkey.txt | apt-key add - && \
wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list && \
apt-get update && \
apt-get install -y --no-install-recommends pvs-studio && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

#######################################################################################
# OCLint
#######################################################################################

RUN OCLINT_RELEASE=oclint-21.05-llvm-12.0.0-x86_64-linux-ubuntu-20.04.tar.gz && \
cd ~ && \
wget https://github.com/oclint/oclint/releases/download/v21.05/${OCLINT_RELEASE} && \
tar xfz ${OCLINT_RELEASE} && \
rm ${OCLINT_RELEASE}

ENV PATH=${PATH}:/root/oclint-21.05/bin

#######################################################################################
# SonarSource
#######################################################################################

RUN apt-get update && \
apt-get install -y --no-install-recommends \
openjdk-11-jdk

ENV SONAR_SCANNER_VERSION=4.4.0.2170

RUN wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip && \
unzip sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip && \
rm sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip

ENV PATH=${PATH}:/sonar-scanner-${SONAR_SCANNER_VERSION}-linux/bin

RUN wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip && \
unzip build-wrapper-linux-x86.zip && \
rm build-wrapper-linux-x86.zip

ENV PATH=${PATH}:/build-wrapper-linux-x86

RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-pip

RUN pip3 install cmakelang==0.6.13
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Docker
The `rttr/docker-ci` image contains various compilers and tools for developing rttr.

0 comments on commit 5bc5f50

Please sign in to comment.