Multi arch nginx-slim docker image
Signed-off-by: Manjunath A Kumatagi <mkumatag@in.ibm.com>
This commit is contained in:
parent
6ed6475e87
commit
3740868d9b
3 changed files with 47 additions and 8 deletions
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
|
||||
FROM gcr.io/google_containers/ubuntu-slim:0.8
|
||||
FROM BASEIMAGE
|
||||
|
||||
COPY build.sh /tmp
|
||||
|
||||
|
|
|
@ -1,14 +1,30 @@
|
|||
all: push
|
||||
|
||||
# 0.0.0 shouldn't clobber any released builds
|
||||
TAG = 0.15
|
||||
PREFIX = gcr.io/google_containers/nginx-slim
|
||||
TAG = 0.16
|
||||
REGISTRY = gcr.io/google_containers
|
||||
ARCH := $(shell go env GOARCH)
|
||||
|
||||
IMGNAME = nginx-slim
|
||||
IMAGE = $(REGISTRY)/${IMGNAME}-$(ARCH)
|
||||
|
||||
# Set default base image dynamically for each arch
|
||||
ifeq ($(ARCH),amd64)
|
||||
BASEIMAGE?=gcr.io/google_containers/ubuntu-slim:0.8
|
||||
endif
|
||||
ifeq ($(ARCH),ppc64le)
|
||||
BASEIMAGE?=ppc64le/ubuntu
|
||||
endif
|
||||
|
||||
TEMP_DIR := $(shell mktemp -d)
|
||||
|
||||
container:
|
||||
docker build --pull -t $(PREFIX):$(TAG) .
|
||||
cp ./* $(TEMP_DIR)
|
||||
cd $(TEMP_DIR) && sed -i.bak 's|BASEIMAGE|$(BASEIMAGE)|g' Dockerfile
|
||||
docker build --pull -t $(IMAGE):$(TAG) $(TEMP_DIR)
|
||||
|
||||
push: container
|
||||
gcloud docker -- push $(PREFIX):$(TAG)
|
||||
gcloud docker -- push $(IMAGE):$(TAG)
|
||||
|
||||
clean:
|
||||
docker rmi -f $(PREFIX):$(TAG) || true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2015 The Kubernetes Authors.
|
||||
#
|
||||
|
@ -32,6 +32,8 @@ export NGINX_SUBSTITUTIONS=bc58cb11844bc42735bbaef7085ea86ace46d05b
|
|||
|
||||
export BUILD_PATH=/tmp/build
|
||||
|
||||
ARCH=$(uname -p)
|
||||
|
||||
get_src()
|
||||
{
|
||||
hash="$1"
|
||||
|
@ -47,6 +49,12 @@ get_src()
|
|||
mkdir "$BUILD_PATH"
|
||||
cd "$BUILD_PATH"
|
||||
|
||||
if [[ ${ARCH} == "ppc64le" ]]; then
|
||||
apt-get update && apt-get install -y software-properties-common && \
|
||||
add-apt-repository -y ppa:ibmpackages/luajit
|
||||
apt-get update && apt-get install -y lua5.1 lua5.1-dev
|
||||
fi
|
||||
|
||||
# install required packages to build
|
||||
apt-get update && apt-get install --no-install-recommends -y \
|
||||
bash \
|
||||
|
@ -120,6 +128,11 @@ cd "$BUILD_PATH/nginx-$NGINX_VERSION"
|
|||
echo "Applying tls nginx patches..."
|
||||
patch -p1 < $BUILD_PATH/nginx__dynamic_tls_records.patch
|
||||
|
||||
CC_OPT='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64'
|
||||
if [[ ${ARCH} == "x86_64" ]]; then
|
||||
CC_OPT+=' -mtune=generic'
|
||||
fi
|
||||
|
||||
./configure \
|
||||
--prefix=/usr/share/nginx \
|
||||
--conf-path=/etc/nginx/nginx.conf \
|
||||
|
@ -154,7 +167,7 @@ patch -p1 < $BUILD_PATH/nginx__dynamic_tls_records.patch
|
|||
--without-mail_imap_module \
|
||||
--without-http_uwsgi_module \
|
||||
--without-http_scgi_module \
|
||||
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' \
|
||||
--with-cc-opt="${CC_OPT}" \
|
||||
--add-module="$BUILD_PATH/ngx_devel_kit-$NDK_VERSION" \
|
||||
--add-module="$BUILD_PATH/set-misc-nginx-module-$SETMISC_VERSION" \
|
||||
--add-module="$BUILD_PATH/nginx-module-vts-$VTS_VERSION" \
|
||||
|
@ -169,7 +182,13 @@ patch -p1 < $BUILD_PATH/nginx__dynamic_tls_records.patch
|
|||
|
||||
echo "Installing CJSON module"
|
||||
cd "$BUILD_PATH/lua-cjson-$LUA_CJSON_VERSION"
|
||||
make LUA_INCLUDE_DIR=/usr/include/luajit-2.0 && make install
|
||||
|
||||
if [[ ${ARCH} == "ppc64le" ]];then
|
||||
LUA_DIR=/usr/include/luajit-2.1
|
||||
else
|
||||
LUA_DIR=/usr/include/luajit-2.0
|
||||
fi
|
||||
make LUA_INCLUDE_DIR=${LUA_DIR} && make install
|
||||
|
||||
echo "Installing lua-resty-http module"
|
||||
# copy lua module
|
||||
|
@ -195,6 +214,10 @@ apt-mark unmarkauto \
|
|||
geoip-bin \
|
||||
openssl
|
||||
|
||||
if [[ ${ARCH} == "ppc64le" ]]; then
|
||||
apt-mark unmarkauto liblua5.1-0
|
||||
fi
|
||||
|
||||
apt-get remove -y --purge \
|
||||
build-essential \
|
||||
gcc-5 \
|
||||
|
|
Loading…
Reference in a new issue