Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pin to a default alpine version (3.11) for _most_ images #1523

Merged
merged 7 commits into from Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 13 additions & 8 deletions Makefile
Expand Up @@ -71,31 +71,32 @@ ARCH := $(shell uname | tr '[:upper:]' '[:lower:]')
LAGOON_VERSION := $(shell git describe --tags --exact-match 2>/dev/null || echo development)
# Name of the Branch we are currently in
BRANCH_NAME :=
DEFAULT_ALPINE_VERSION := 3.11

#######
####### Functions
#######

# Builds a docker image. Expects as arguments: name of the image, location of Dockerfile, path of
# Docker Build Context
docker_build = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) -t $(CI_BUILD_TAG)/$(1) -f $(2) $(3)
docker_build = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) --build-arg ALPINE_VERSION=$(DEFAULT_ALPINE_VERSION) -t $(CI_BUILD_TAG)/$(1) -f $(2) $(3)

# Build a Python docker image. Expects as arguments:
# 1. Python version
# 2. Location of Dockerfile
# 3. Path of Docker Build context
docker_build_python = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) --build-arg PYTHON_VERSION=$(1) -t $(CI_BUILD_TAG)/python:$(2) -f $(3) $(4)
docker_build_python = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) --build-arg PYTHON_VERSION=$(1) --build-arg ALPINE_VERSION=$(2) -t $(CI_BUILD_TAG)/python:$(3) -f $(4) $(5)

docker_build_elastic = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) -t $(CI_BUILD_TAG)/$(2):$(1) -f $(3) $(4)

# Build a PHP docker image. Expects as arguments:
# 1. PHP version
# 2. PHP version and type of image (ie 7.0-fpm, 7.0-cli etc)
# 2. PHP version and type of image (ie 7.3-fpm, 7.3-cli etc)
# 3. Location of Dockerfile
# 4. Path of Docker Build Context
docker_build_php = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) --build-arg PHP_VERSION=$(1) --build-arg PHP_IMAGE_VERSION=$(1) -t $(CI_BUILD_TAG)/php:$(2) -f $(3) $(4)
docker_build_php = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) --build-arg PHP_VERSION=$(1) --build-arg PHP_IMAGE_VERSION=$(1) --build-arg ALPINE_VERSION=$(2) -t $(CI_BUILD_TAG)/php:$(3) -f $(4) $(5)

docker_build_node = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) --build-arg NODE_VERSION=$(1) -t $(CI_BUILD_TAG)/node:$(2) -f $(3) $(4)
docker_build_node = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) --build-arg NODE_VERSION=$(1) --build-arg ALPINE_VERSION=$(2) -t $(CI_BUILD_TAG)/node:$(3) -f $(4) $(5)

docker_build_solr = docker build $(DOCKER_BUILD_PARAMS) --build-arg LAGOON_VERSION=$(LAGOON_VERSION) --build-arg IMAGE_REPO=$(CI_BUILD_TAG) --build-arg SOLR_MAJ_MIN_VERSION=$(1) -t $(CI_BUILD_TAG)/solr:$(2) -f $(3) $(4)

Expand Down Expand Up @@ -232,10 +233,11 @@ $(build-pythonimages): build/commons
$(eval clean = $(subst build/python__,,$@))
$(eval version = $(word 1,$(subst -, ,$(clean))))
$(eval type = $(word 2,$(subst -, ,$(clean))))
$(eval alpine_version := $(shell case $(version) in (2.7) echo "3.10" ;; (*) echo $(DEFAULT_ALPINE_VERSION) ;; esac ))
# this fills variables only if $type is existing, if not they are just empty
$(eval type_dash = $(if $(type),-$(type)))
# Call the docker build
$(call docker_build_python,$(version),$(version)$(type_dash),images/python$(type_dash)/Dockerfile,images/python$(type_dash))
$(call docker_build_python,$(version),$(alpine_version),$(version)$(type_dash),images/python$(type_dash)/Dockerfile,images/python$(type_dash))
# Touch an empty file which make itself is using to understand when the image has been last build
touch $@

Expand Down Expand Up @@ -271,14 +273,16 @@ $(build-phpimages): build/commons
$(eval version = $(word 1,$(subst -, ,$(clean))))
$(eval type = $(word 2,$(subst -, ,$(clean))))
$(eval subtype = $(word 3,$(subst -, ,$(clean))))
$(eval alpine_version := $(shell case $(version) in (5.6) echo "3.8" ;; (7.0) echo "3.7" ;; (7.1) echo "3.10" ;; (*) echo $(DEFAULT_ALPINE_VERSION) ;; esac ))
# this fills variables only if $type is existing, if not they are just empty
$(eval type_dash = $(if $(type),-$(type)))
$(eval type_slash = $(if $(type),/$(type)))
# if there is a subtype, add it. If not, just keep what we already had
$(eval type_dash = $(if $(subtype),-$(type)-$(subtype),$(type_dash)))
$(eval type_slash = $(if $(subtype),/$(type)-$(subtype),$(type_slash)))

# Call the docker build
$(call docker_build_php,$(version),$(version)$(type_dash),images/php$(type_slash)/Dockerfile,images/php$(type_slash))
$(call docker_build_php,$(version),$(alpine_version),$(version)$(type_dash),images/php$(type_slash)/Dockerfile,images/php$(type_slash))
# Touch an empty file which make itself is using to understand when the image has been last build
touch $@

Expand Down Expand Up @@ -349,11 +353,12 @@ $(build-nodeimages): build/commons
$(eval clean = $(subst build/node__,,$@))
$(eval version = $(word 1,$(subst -, ,$(clean))))
$(eval type = $(word 2,$(subst -, ,$(clean))))
$(eval alpine_version := $(shell case $(version) in (6) echo "" ;; (9) echo "" ;; (*) echo $(DEFAULT_ALPINE_VERSION) ;; esac ))
# this fills variables only if $type is existing, if not they are just empty
$(eval type_dash = $(if $(type),-$(type)))
$(eval type_slash = $(if $(type),/$(type)))
# Call the docker build
$(call docker_build_node,$(version),$(version)$(type_dash),images/node$(type_slash)/Dockerfile,images/node$(type_slash))
$(call docker_build_node,$(version),$(alpine_version),$(version)$(type_dash),images/node$(type_slash)/Dockerfile,images/node$(type_slash))
# Touch an empty file which make itself is using to understand when the image has been last build
touch $@

Expand Down
3 changes: 2 additions & 1 deletion images/commons/Dockerfile
@@ -1,4 +1,5 @@
FROM alpine
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION}

LABEL maintainer="amazee.io"

Expand Down
2 changes: 1 addition & 1 deletion images/curator/Dockerfile
@@ -1,6 +1,6 @@
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM bobrik/curator
FROM bobrik/curator:5.7.6

USER root

Expand Down
2 changes: 1 addition & 1 deletion images/docker-host/Dockerfile
@@ -1,6 +1,6 @@
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM docker:stable-dind
FROM docker:19.03-dind

LABEL maintainer="amazee.io"
ENV LAGOON=docker-host
Expand Down
3 changes: 2 additions & 1 deletion images/nginx/Dockerfile
@@ -1,6 +1,7 @@
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM openresty/openresty:alpine
# alpine 3.11 per https://github.com/openresty/docker-openresty/blob/master/alpine/Dockerfile
FROM openresty/openresty:1.15.8.2-alpine

LABEL maintainer="amazee.io"
ENV LAGOON=nginx
Expand Down
3 changes: 2 additions & 1 deletion images/node/Dockerfile
@@ -1,7 +1,8 @@
ARG NODE_VERSION
ARG ALPINE_VERSION
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM node:${NODE_VERSION}-alpine
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION}

LABEL maintainer="amazee.io"
ENV LAGOON=node
Expand Down
3 changes: 2 additions & 1 deletion images/oc/Dockerfile
@@ -1,6 +1,7 @@
ARG ALPINE_VERSION
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM golang:alpine as golang
FROM golang:1.13-alpine${ALPINE_VERSION} as golang

RUN apk add --no-cache git
RUN go get github.com/a8m/envsubst/cmd/envsubst
Expand Down
5 changes: 3 additions & 2 deletions images/php/fpm/Dockerfile
@@ -1,8 +1,9 @@
ARG PHP_VERSION
ARG PHP_IMAGE_VERSION
ARG ALPINE_VERSION
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM php:${PHP_IMAGE_VERSION}-fpm-alpine
FROM php:${PHP_IMAGE_VERSION}-fpm-alpine${ALPINE_VERSION}

LABEL maintainer="amazee.io"
ENV LAGOON=php
Expand Down Expand Up @@ -114,4 +115,4 @@ ENV LAGOON_ENVIRONMENT_TYPE=development
WORKDIR /app

ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"]
CMD ["/usr/local/sbin/php-fpm", "-F", "-R"]
CMD ["/usr/local/sbin/php-fpm", "-F", "-R"]
3 changes: 2 additions & 1 deletion images/postgres/Dockerfile
@@ -1,6 +1,7 @@
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM postgres:11-alpine
# alpine 3.11 from https://github.com/docker-library/postgres/blob/master/11/alpine/Dockerfile
FROM postgres:11.6-alpine

ARG LAGOON_VERSION
ENV LAGOON_VERSION=$LAGOON_VERSION
Expand Down
3 changes: 2 additions & 1 deletion images/python/Dockerfile
@@ -1,7 +1,8 @@
ARG PYTHON_VERSION
ARG IMAGE_REPO
ARG ALPINE_VERSION
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM python:${PYTHON_VERSION}-alpine3.10
FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION}

LABEL maintainer="amazee.io"
ENV LAGOON=python
Expand Down
3 changes: 2 additions & 1 deletion images/rabbitmq/Dockerfile
@@ -1,6 +1,7 @@
ARG IMAGE_REPO
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM rabbitmq:3-management
# alpine 3.11 as per https://github.com/docker-library/rabbitmq/blob/master/3.8/alpine/Dockerfile
FROM rabbitmq:3.8-management-alpine

ARG LAGOON_VERSION
ENV LAGOON_VERSION=$LAGOON_VERSION
Expand Down
3 changes: 2 additions & 1 deletion images/redis/Dockerfile
@@ -1,6 +1,7 @@
ARG IMAGE_REPO
ARG ALPINE_VERSION
FROM ${IMAGE_REPO:-lagoon}/commons as commons
FROM redis:alpine
FROM redis:5.0-alpine${ALPINE_VERSION}

LABEL maintainer="amazee.io"
ENV LAGOON=redis
Expand Down
2 changes: 1 addition & 1 deletion local-dev/api-data-watcher-pusher/Dockerfile
@@ -1,4 +1,4 @@
FROM alpine:3.7
FROM alpine:3.11

RUN apk add --no-cache mysql-client tini openssl bash wget curl nodejs nodejs-npm \
&& npm config set unsafe-perm true \
Expand Down
1 change: 1 addition & 0 deletions tests/Dockerfile
@@ -1,3 +1,4 @@
# Held at alpine 3.10 because of Python2 dependencies not available in 3.11
FROM alpine:3.10

RUN apk add --no-cache \
Expand Down
2 changes: 1 addition & 1 deletion tests/checks/check-url-redirect-host.yaml
Expand Up @@ -8,7 +8,7 @@
validate_certs: no
register: result
until: result.location | default('') | regex_search(expected_redirect_location)
retries: 5
retries: 20
delay: 10
- name: "{{ testname }} - Check if URL {{url}} with sending Host: {{ host }} redirects to the location {{expected_redirect_location}}"
debug: msg="Success!!!"
Expand Down
2 changes: 1 addition & 1 deletion tests/checks/check-url-redirect.yaml
Expand Up @@ -7,7 +7,7 @@
validate_certs: no
register: result
until: result.location | default('') | regex_search(expected_redirect_location)
retries: 5
retries: 20
delay: 10
- name: "{{ testname }} - Check if URL {{url}} redirects to the location {{expected_redirect_location}}"
debug: msg="Success!!!"
Expand Down