1.16.0-debian-9-r0 release

This commit is contained in:
Bitnami Bot 2019-04-25 10:23:15 +00:00
parent 9c4765f6dd
commit 613c46b877
11 changed files with 377 additions and 4 deletions

View File

@ -0,0 +1,34 @@
FROM bitnami/minideb-extras-base:stretch-r231
LABEL maintainer "Bitnami <containers@bitnami.com>"
ENV BITNAMI_PKG_CHMOD="-R g+rwX" \
BITNAMI_PKG_EXTRA_DIRS="/bitnami/nginx/conf" \
HOME="/" \
OS_ARCH="amd64" \
OS_FLAVOUR="debian-9" \
OS_NAME="linux"
# Install required system packages and dependencies
RUN install_packages libc6 libpcre3 libssl1.1 zlib1g
RUN . ./libcomponent.sh && component_unpack "nginx" "1.16.0-0" --checksum b08c5b2a428e2e54726d47e290102496780db1ddd4a0a67bed82da6c34e56784
RUN ln -sf /opt/bitnami/nginx/html /app
RUN ln -sf /dev/stdout /opt/bitnami/nginx/logs/access.log
RUN ln -sf /dev/stderr /opt/bitnami/nginx/logs/error.log
COPY rootfs /
RUN /prepare.sh
ENV BITNAMI_APP_NAME="nginx" \
BITNAMI_IMAGE_VERSION="1.16.0-debian-9-r0" \
NAMI_PREFIX="/.nami" \
NGINX_DAEMON_GROUP="" \
NGINX_DAEMON_USER="" \
NGINX_HTTPS_PORT_NUMBER="443" \
NGINX_HTTP_PORT_NUMBER="8080" \
PATH="/opt/bitnami/nginx/sbin:$PATH"
EXPOSE 8080
WORKDIR /app
USER 1001
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/run.sh" ]

View File

@ -0,0 +1,7 @@
version: '2'
services:
nginx:
image: 'bitnami/nginx:1.16'
ports:
- '80:8080'

View File

@ -0,0 +1,25 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
#set -o xtrace
# shellcheck disable=SC1091
# Load libraries
. /libbitnami.sh
. /libnginx.sh
# Load NGINX environment variables
eval "$(nginx_env)"
print_welcome_page
if [[ "$*" = "/run.sh" ]]; then
info "** Starting NGINX setup **"
/setup.sh
info "** NGINX setup finished! **"
fi
echo ""
exec "$@"

View File

@ -0,0 +1,173 @@
#!/bin/bash
#
# Bitnami NGINX library
# shellcheck disable=SC1091
# Load Generic Libraries
. /libfile.sh
. /liblog.sh
. /libos.sh
. /libservice.sh
. /libvalidations.sh
# Functions
########################
# Check if NGINX is running
# Globals:
# NGINX_TMPDIR
# Arguments:
# None
# Returns:
# Boolean
#########################
is_nginx_running() {
local pid
pid=$(get_pid_from_file "${NGINX_TMPDIR}/nginx.pid")
if [[ -z "$pid" ]]; then
false
else
is_service_running "$pid"
fi
}
########################
# Stop NGINX
# Globals:
# NGINX_TMPDIR
# Arguments:
# None
# Returns:
# None
#########################
nginx_stop() {
! is_nginx_running && return
debug "Stopping NGINX..."
stop_service_using_pid "${NGINX_TMPDIR}/nginx.pid"
}
########################
# Start NGINX and wait until it's ready
# Globals:
# NGINX_*
# Arguments:
# None
# Returns:
# None
#########################
nginx_start() {
is_nginx_running && return
debug "Starting NGIX..."
if am_i_root; then
gosu "$NGINX_DAEMON_USER" "${NGINX_BASEDIR}/sbin/nginx" -c "${NGINX_CONFDIR}/nginx.conf"
else
"${NGINX_BASEDIR}/sbin/nginx" -c "${NGINX_CONFDIR}/nginx.conf"
fi
local counter=3
while ! is_nginx_running ; do
if [[ "$counter" -ne 0 ]]; then
break
fi
sleep 1;
counter=$((counter - 1))
done
}
########################
# Load global variables used on NGINX configuration
# Globals:
# NGINX_*
# Arguments:
# None
# Returns:
# Series of exports to be used as 'eval' arguments
#########################
nginx_env() {
cat <<"EOF"
export NGINX_BASEDIR="/opt/bitnami/nginx"
export NGINX_VOLUME="/bitnami/nginx"
export NGINX_EXTRAS_DIR="/opt/bitnami/extra/nginx"
export NGINX_TEMPLATES_DIR="${NGINX_EXTRAS_DIR}/templates"
export NGINX_TMPDIR="${NGINX_BASEDIR}/tmp"
export NGINX_CONFDIR="${NGINX_BASEDIR}/conf"
export NGINX_LOGDIR="${NGINX_BASEDIR}/logs"
export PATH="${NGINX_BASEDIR}/sbin:$PATH"
EOF
}
########################
# Validate settings in NGINX_* env vars
# Globals:
# NGINX_*
# Arguments:
# None
# Returns:
# None
#########################
nginx_validate() {
info "Validating settings in NGINX_* env vars..."
local validate_port_args=()
! am_i_root && validate_port_args+=("-unprivileged")
if ! err=$(validate_port "${validate_port_args[@]}" "$NGINX_HTTP_PORT_NUMBER"); then
error "An invalid port was specified in the environment variable NGINX_HTTP_PORT_NUMBER: $err"
exit 1
fi
for var in "NGINX_DAEMON_USER" "NGINX_DAEMON_GROUP"; do
if am_i_root; then
if [[ -z "${!var}" ]]; then
error "The $var environment variable cannot be empty when running as root"
exit 1
fi
else
if [[ -n "${!var}" ]]; then
warn "The $var environment variable will be ignored when running as non-root"
fi
fi
done
}
########################
# Ensure NGINX is initialized
# Globals:
# NGINX_*
# Arguments:
# None
# Returns:
# None
#########################
nginx_initialize() {
info "Initializing NGINX..."
# Persisted configuration files from old versions
if [[ -f "$NGINX_VOLUME/conf/nginx.conf" ]]; then
warn "'nginx.conf' was found in a legacy location: ${NGINX_VOLUME}/conf/nginx.conf"
warn " Please use ${NGINX_CONFDIR}/nginx.conf instead"
debug "Moving 'nginx.conf' file to new location..."
cp "$NGINX_VOLUME/conf/nginx.conf" "$NGINX_CONFDIR/nginx.conf"
fi
if ! is_dir_empty "$NGINX_VOLUME/conf/vhosts"; then
warn "Custom vhosts config files were found in a legacy directory: $NGINX_VOLUME/conf/vhosts"
warn " Please use ${NGINX_CONFDIR}/vhosts instead"
debug "Moving vhosts config files to new location..."
cp -r "$NGINX_VOLUME/conf/vhosts" "$NGINX_CONFDIR"
fi
if [[ -e "${NGINX_CONFDIR}/nginx.conf" ]]; then
debug "Custom configuration detected. Using it..."
return
else
debug "'nginx.conf' not found. Applying bitnami configuration..."
debug "Ensuring expected directories/files exist..."
for dir in "$NGINX_TMPDIR" "$NGINX_CONFDIR" "${NGINX_CONFDIR}/vhosts"; do
ensure_dir_exists "$dir" "$NGINX_DAEMON_USER"
done
debug "Rendering 'nginx.conf.tpl' template..."
render-template "${NGINX_TEMPLATES_DIR}/nginx.conf.tpl" > "${NGINX_CONFDIR}/nginx.conf"
echo 'fastcgi_param HTTP_PROXY "";' >> "${NGINX_CONFDIR}/fastcgi_params"
fi
}

View File

@ -0,0 +1,6 @@
{
"httpPort": "{{$global.env.NGINX_HTTP_PORT_NUMBER}}",
"httpsPort": "{{$global.env.NGINX_HTTPS_PORT_NUMBER}}",
"systemGroup": "{{$global.env.NGINX_DAEMON_GROUP}}",
"systemUser": "{{$global.env.NGINX_DAEMON_USER}}"
}

View File

@ -0,0 +1,64 @@
# based on http://brainspl.at/nginx.conf.txt
{{#if NGINX_DAEMON_USER}}{{#if NGINX_DAEMON_GROUP}}
user {{NGINX_DAEMON_USER}} {{NGINX_DAEMON_GROUP}};
{{/if}}{{/if}}
worker_processes auto;
error_log "{{NGINX_LOGDIR}}/error.log";
pid "{{NGINX_TMPDIR}}/nginx.pid";
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
add_header X-Frame-Options SAMEORIGIN;
client_body_temp_path "{{NGINX_TMPDIR}}/client_body" 1 2;
proxy_temp_path "{{NGINX_TMPDIR}}/proxy" 1 2;
fastcgi_temp_path "{{NGINX_TMPDIR}}/fastcgi" 1 2;
scgi_temp_path "{{NGINX_TMPDIR}}/scgi" 1 2;
uwsgi_temp_path "{{NGINX_TMPDIR}}/uwsgi" 1 2;
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log "{{NGINX_LOGDIR}}/access.log";
# no sendfile on OSX
sendfile on;
tcp_nopush on;
tcp_nodelay off;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
include "{{NGINX_CONFDIR}}/vhosts/*.conf";
# HTTP Server
server {
# port to listen on. Can also be set to an IP:PORT
listen {{NGINX_HTTP_PORT_NUMBER}};
location /status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
}

View File

@ -0,0 +1,20 @@
#!/bin/bash
# shellcheck disable=SC1091
# Load libraries
. /libnginx.sh
# Load NGINX environment variables
eval "$(nginx_env)"
for dir in "/bitnami" "$NGINX_VOLUME" "$NGINX_CONFDIR" "$NGINX_BASEDIR" "$NGINX_TMPDIR"; do
ensure_dir_exists "$dir"
chmod -R g+rwX "$dir"
done
# Users can mount their html sites at /app
ln -sf "$NGINX_BASEDIR/html" /app
# Redirect all logging to stdout/stderr
ln -sf /dev/stdout "$NGINX_LOGDIR/access.log"
ln -sf /dev/stderr "$NGINX_LOGDIR/error.log"

View File

@ -0,0 +1,21 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
#set -o xtrace
# shellcheck disable=SC1091
# Load libraries
. /liblog.sh
. /libnginx.sh
# Load NGINX environment variables
eval "$(nginx_env)"
info "** Starting NGINX **"
if am_i_root; then
exec gosu "$NGINX_DAEMON_USER" "$NGINX_BASEDIR/sbin/nginx" -c "$NGINX_CONFDIR/nginx.conf" -g "daemon off;"
else
exec "$NGINX_BASEDIR/sbin/nginx" -c "$NGINX_CONFDIR/nginx.conf" -g "daemon off;"
fi

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
#set -o xtrace
# shellcheck disable=SC1091
# Load libraries
. /libos.sh
. /libfs.sh
. /libnginx.sh
# Load NGINX environment variables
eval "$(nginx_env)"
# Ensure NGINX environment variables settings are valid
nginx_validate
# Ensure NGINX is stopped when this script ends
trap "nginx_stop" EXIT
am_i_root && ensure_user_exists "$NGINX_DAEMON_USER" "$NGINX_DAEMON_GROUP"
# Ensure NGINX is initialized
nginx_initialize

View File

@ -46,9 +46,9 @@ Non-root container images add an extra layer of security and are generally recom
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/).
* [`1.14-rhel-7`, `1.14.2-rhel-7-r79` (1.14/rhel-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/1.14.2-rhel-7-r79/1.14/rhel-7/Dockerfile)
* [`1.14-ol-7`, `1.14.2-ol-7-r131` (1.14/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/1.14.2-ol-7-r131/1.14/ol-7/Dockerfile)
* [`1.14-debian-9`, `1.14.2-debian-9-r125`, `1.14`, `1.14.2`, `1.14.2-r125`, `latest` (1.14/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/1.14.2-debian-9-r125/1.14/debian-9/Dockerfile)
* [`1.16-debian-9`, `1.16.0-debian-9-r0`, `1.16`, `1.16.0`, `1.16.0-r0`, `latest` (1.16/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/1.16.0-debian-9-r0/1.16/debian-9/Dockerfile)
* [`1.16-rhel-7`, `0.0.0-rhel-7-r0` (1.16/rhel-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/0.0.0-rhel-7-r0/1.16/rhel-7/Dockerfile)
* [`1.16-ol-7`, `0.0.0-ol-7-r0` (1.16/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-nginx/blob/0.0.0-ol-7-r0/1.16/ol-7/Dockerfile)
# Get this image

View File

@ -2,6 +2,6 @@ version: '2'
services:
nginx:
image: 'bitnami/nginx:1.14'
image: 'bitnami/nginx:1.16'
ports:
- '80:8080'