While talking to a client about what languages are being used and how their development process works, we quickly learned that no pre-made docker images would work, and that GitLab's Auto DevOps features were not a good fit for them. Because of this, we created some custom docker images with code-auditing tools they wanted.
Dockerfile
that has grep
and editorconfig-checker
preinstalled.FROM alpine AS base
RUN apk update && apk add --no-cache sed cppcheck grep jq uuidgen editorconfig-checker curl
LABEL maintainer="deathcamel57"
complexity
preinstalled.FROM ubuntu AS base
RUN ln -s /usr/bin/dpkg-split /usr/sbin/dpkg-split
RUN ln -s /usr/bin/dpkg-deb /usr/sbin/dpkg-deb
RUN ln -s /bin/rm /usr/sbin/rm
RUN ln -s /bin/tar /usr/sbin/tar
RUN apt-get update && apt-get install -y complexity tree jq sed
LABEL maintainer="deathcamel57"
doxygen
preinstalled.FROM alpine AS base
RUN apk update && apk add --no-cache doxygen
LABEL maintainer="deathcamel57"
Although creating Docker images for other architectures seems difficult, it's honestly one of the easiest parts of this kind of project. This is because Docker has a their Buildx tool.
To use it to produce images, we created a final CI/CD pipeline to build multiple architecture images and push them to our internal registry for their usage.
image: docker:20.10.12
variables:
BUILDX_VERSION: "0.7.1"
BUILDX_HOST: "linux"
BUILDX_ARCH: "arm64"
before_script:
- wget -O /usr/bin/docker-buildx https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.${BUILDX_HOST}-${$BUILDX_ARCH} - chmod +x /usr/bin/docker-buildx
build:
tags:
- no-dind
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-buildx create --use
- docker-buildx build
--platform linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
--tag ${CI_REGISTRY_IMAGE}:latest
--push
.
These containers went on to be used in a GitLab CI/CD pipeline to provide automated code review.