From 72747ef3ca0695ba9bd01a0e9e742680a3194c5c Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Wed, 6 Jun 2018 09:11:38 +0000 Subject: [PATCH] Add graphicsmagick versioned feature --- .gitlab-ci.yml | 4 +++- Dockerfile.custom | 6 +++++ README.md | 17 +++++++------- scripts/custom-docker-build | 14 ++++++++++++ scripts/install-graphicsmagick | 41 ++++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 9 deletions(-) create mode 100755 scripts/install-graphicsmagick diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e2e0fe5..3252689 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,7 +45,7 @@ before_script: .build_and_deploy_custom: &build_and_deploy_custom stage: build script: - - ./scripts/custom-docker-build $CI_BUILD_NAME -t "$CI_REGISTRY_IMAGE:$CI_JOB_NAME" + - ./scripts/custom-docker-build $CI_JOB_NAME -t "$CI_REGISTRY_IMAGE:$CI_JOB_NAME" - docker push "$CI_REGISTRY_IMAGE:$CI_JOB_NAME" only: - master @@ -75,6 +75,7 @@ ruby-2.3.7-golang-1.9-git-2.16-chrome-63.0-node-8.x-yarn-1.2-postgresql-9.6 test ruby-2.3.7-golang-1.9-git-2.17-chrome-63.0-node-8.x-yarn-1.2-postgresql-9.6 test: *test_custom ruby-2.3.7-golang-1.9-git-2.17-chrome-65.0-node-8.x-yarn-1.2-postgresql-9.6 test: *test_custom ruby-2.4.4-golang-1.9-git-2.17-chrome-65.0-node-8.x-yarn-1.2-postgresql-9.6 test: *test_custom +ruby-2.4.4-golang-1.9-git-2.17-chrome-65.0-node-8.x-yarn-1.2-postgresql-9.6-graphicsmagick-1.3.29 test: *test_custom # Not used anymore (?) golang-1.9-git-2.9.0 test: *test_custom @@ -130,6 +131,7 @@ ruby-2.3.7-golang-1.9-git-2.16-chrome-63.0-node-8.x-yarn-1.2-postgresql-9.6: *bu ruby-2.3.7-golang-1.9-git-2.17-chrome-63.0-node-8.x-yarn-1.2-postgresql-9.6: *build_and_deploy_custom ruby-2.3.7-golang-1.9-git-2.17-chrome-65.0-node-8.x-yarn-1.2-postgresql-9.6: *build_and_deploy_custom ruby-2.4.4-golang-1.9-git-2.17-chrome-65.0-node-8.x-yarn-1.2-postgresql-9.6: *build_and_deploy_custom +ruby-2.4.4-golang-1.9-git-2.17-chrome-65.0-node-8.x-yarn-1.2-postgresql-9.6-graphicsmagick-1.3.29: *build_and_deploy_custom # Used by https://gitlab.com/gitlab-org/trello-power-up/blob/master/.gitlab-ci.yml (?) node-8.9-chrome-63.0-yarn-1.2: *build_and_deploy_custom diff --git a/Dockerfile.custom b/Dockerfile.custom index 0e341dc..80c1e8a 100644 --- a/Dockerfile.custom +++ b/Dockerfile.custom @@ -50,6 +50,12 @@ ARG TERRAFORM_VERSION ARG TERRAFORM_DOWNLOAD_SHA256 RUN if [ -n "$TERRAFORM_VERSION" ] ; then /scripts/install-terraform $TERRAFORM_VERSION $TERRAFORM_DOWNLOAD_SHA256; fi +# GraphicsMagick +ARG GRAPHISMAGICK_VERSION +ARG GRAPHISMAGICK_DOWNLOAD_URL=http://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/1.3/GraphicsMagick-${GRAPHISMAGICK_VERSION}.tar.gz +ARG GRAPHISMAGICK_DOWNLOAD_SHA256 +RUN if [ -n "$GRAPHISMAGICK_VERSION" ]; then /scripts/install-graphicsmagick && gm version; fi + RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en diff --git a/README.md b/README.md index 80443d4..b24d3c5 100644 --- a/README.md +++ b/README.md @@ -46,14 +46,15 @@ Each of the following parts represents another feature and version. Available options are: 1. `golang` -2. `git` -3. `chrome` -4. `node` -5. `yarn` -6. `phantomjs` -7. `postgres` -8. `terraform` -9. `ansible` +1. `git` +1. `chrome` +1. `node` +1. `yarn` +1. `phantomjs` +1. `postgres` +1. `terraform` +1. `ansible` +1. `graphicsmagick` ### Adding a new build diff --git a/scripts/custom-docker-build b/scripts/custom-docker-build index 4f23264..b7df701 100755 --- a/scripts/custom-docker-build +++ b/scripts/custom-docker-build @@ -118,6 +118,19 @@ function print_terraform_args() { printf -- "--build-arg TERRAFORM_DOWNLOAD_SHA256=%s " "$TERRAFORM_DOWNLOAD_SHA256" } +function print_graphicsmagick_args() { + case "$1" in + 1.3.29) + GRAPHISMAGICK_VERSION=1.3.29 + GRAPHISMAGICK_DOWNLOAD_SHA256=de820cd10597205941a7e9d02c2e679231e92e8e769c204ef09034d2279ad453 + ;; + *) echo "Unknown graphicsmagick version $1"; exit 1; + esac + + printf -- "--build-arg GRAPHISMAGICK_VERSION=%s " "$GRAPHISMAGICK_VERSION" + printf -- "--build-arg GRAPHISMAGICK_DOWNLOAD_SHA256=%s " "$GRAPHISMAGICK_DOWNLOAD_SHA256" +} + function parse_arguments() { read base read base_version @@ -141,6 +154,7 @@ function parse_arguments() { postgresql) print_postgres_args $version ;; ansible) print_ansible_args $version ;; terraform) print_terraform_args $version ;; + graphicsmagick) print_graphicsmagick_args $version ;; *) exit 1;; esac done diff --git a/scripts/install-graphicsmagick b/scripts/install-graphicsmagick new file mode 100755 index 0000000..f5e8166 --- /dev/null +++ b/scripts/install-graphicsmagick @@ -0,0 +1,41 @@ +#!/bin/bash + +set -xeuo pipefail +IFS=$'\n\t' + +mkdir build \ + && curl -fsSL "$GRAPHISMAGICK_DOWNLOAD_URL" -o graphicsmagick.tar.gz \ + && echo "$GRAPHISMAGICK_DOWNLOAD_SHA256 graphicsmagick.tar.gz" | sha256sum -c - \ + && tar -C build -xzf graphicsmagick.tar.gz \ + && cd build/GraphicsMagick-$GRAPHISMAGICK_VERSION \ + && chmod +x configure \ + && ./configure \ + --prefix=/usr/local \ + --disable-openmp \ + --without-magick-plus-plus \ + --with-perl=no \ + --without-bzlib \ + --without-dps \ + --without-fpx \ + --without-gslib \ + --without-jbig \ + --without-webp \ + --without-jpeg \ + --without-jp2 \ + --without-lcms2 \ + --without-lzma \ + --with-png \ + --with-sysroot=/usr/local \ + --without-tiff \ + --without-trio \ + --without-ttf \ + --without-umem \ + --without-wmf \ + --without-xml \ + --with-zlib \ + --without-x \ + && make \ + && make install \ + && cd ../.. \ + && rm -rf build \ + && rm graphicsmagick.tar.gz