Skip to content
Snippets Groups Projects
Commit 010ab8ff authored by Szymon Tomasz Datko's avatar Szymon Tomasz Datko
Browse files

Base Dockerfile and build script, README update

parent f3d68237
No related branches found
No related tags found
No related merge requests found
#
# Dockerfile for security-services/code-checking
#
# Maintainer:
# CERN IT-DI-CSO <computer.security@cern.ch>
#
#
# Base image and image metadata
#
FROM centos:latest
MAINTAINER "CERN IT-DI-CSO <computer.security@cern.ch>"
#
# Helpful variables
#
ENV basedir /opt
#
# Enable extra repositories
#
RUN yum -y install epel-release
#
# Update the software and install basic development tools
#
RUN yum -y update
RUN yum -y groups mark convert
RUN yum -y groupinstall 'Development Tools'
#
# Install Python development packages
#
RUN yum -y install python-devel python-flake8 python-pep8
#
# Install general useful software
#
RUN yum -y install wget unzip unrar sudo
RUN yum -y install p7zip p7zip-plugins
RUN yum -y install htop vim
#
# Install dependencies for RATS
#
RUN yum -y install expat expat-devel
RUN yum -y install flex flex-devel
#
# Install dependencies for PMD and FindBugs
#
RUN yum -y install java
#
# Install RATS
#
WORKDIR $basedir
RUN wget https://rough-auditing-tool-for-security.googlecode.com/files/rats-2.4.tgz
RUN tar -xzf rats-2.4.tgz
WORKDIR $basedir/rats-2.4
RUN ./configure && make && make install
#
# Install PyLint
#
RUN yum -y install pylint
#
# Install PMD
#
WORKDIR $basedir
RUN wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F5.5.1/pmd-bin-5.5.1.zip
RUN unzip pmd-bin-5.5.1.zip
#
# Install FindBugs
#
WORKDIR $basedir
RUN wget http://prdownloads.sourceforge.net/findbugs/findbugs-3.0.1.tar.gz
RUN tar -xzf findbugs-3.0.1.tar.gz
# Security-Services/Code-Checking
This repository contains Dockerfile with additional tools that are used
to build Docker image **Security-Services/Code-Checking** for automated
code checking with Gitlab-CI.
## Script usage
```
[fenek@Polluks Security-Services-Code-Checking]$ ./build.sh --help
Usage:
./build.sh [TAG]
./build.sh [-h|--help]
Arguments:
TAG -- tag string for image, current date by default
-h|--help -- display information about usage
Please, note that Docker service must be running on host.
```
build.sh 0 → 100755
#!/bin/sh
#
# Script to build Docker image from Dockerfile
#
# Maintainer:
# CERN IT-DI-CSO <computer.security@cern.ch>
#
#
# Build parameters
#
REPOSITORY='security-services'
IMAGENAME='code-checking'
IMAGETAG="${1:-$( date +'%Y-%m-%d' )}"
#
# Display help, if needed
#
if [[ "${1}" == '-h' || "${1}" == '--help' || "${#}" > 1 ]]; then
echo 'Usage:'
echo " ${0} [TAG]"
echo " ${0} [-h|--help]"
echo ''
echo 'Arguments:'
echo ' TAG -- tag string for image, current date by default'
echo ' -h|--help -- display information about usage'
echo ''
echo 'Please, note that Docker service must be running on host.'
exit 0
fi
#
# Display image tag
#
echo "Building image with tag: ${IMAGETAG}"
echo ''
#
# Find and delete any previous image with specified tag
#
PREVIOUS=$( docker images \
| grep "${REPOSITORY}/${IMAGENAME}" \
| grep -e "${IMAGETAG}" \
| awk '{ print $3; }' \
| sort --unique \
| tr '\n' ' ' \
| sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' )
if [[ ! -z "${PREVIOUS}" ]]; then
docker rmi --force "${PREVIOUS}"
fi
#
# Build the image
#
docker build \
--no-cache='true' \
--tag="${REPOSITORY}/${IMAGENAME}:latest" \
--tag="${REPOSITORY}/${IMAGENAME}:${IMAGETAG}" \
. # Run inside current directory
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment