mirror of
https://github.com/bitnami/containers.git
synced 2026-03-14 06:48:11 +08:00
4.17.1-debian-10-r0 release
This commit is contained in:
35
bitnami/express/4/debian-10/Dockerfile
Normal file
35
bitnami/express/4/debian-10/Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
FROM bitnami/minideb:buster
|
||||||
|
LABEL maintainer "Bitnami <containers@bitnami.com>"
|
||||||
|
|
||||||
|
ENV BITNAMI_PKG_CHMOD="-R g+rwX" \
|
||||||
|
HOME="/" \
|
||||||
|
PATH="/opt/bitnami/sequelize-cli/bin:/opt/bitnami/node/bin:/opt/bitnami/git/bin:/opt/bitnami/express/bin:/opt/bitnami/bower/bin:/opt/bitnami/nami/bin:$PATH"
|
||||||
|
|
||||||
|
COPY prebuildfs /
|
||||||
|
# Install required system packages and dependencies
|
||||||
|
RUN install_packages ca-certificates curl dirmngr ghostscript gnupg imagemagick libbz2-1.0 libc6 libcom-err2 libcurl4 libffi6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libidn2-0 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 libncursesw6 libnettle6 libnghttp2-14 libp11-kit0 libpsl5 libreadline7 librtmp1 libsasl2-2 libsqlite3-0 libssh2-1 libssl1.1 libstdc++6 libtasn1-6 libtinfo6 libunistring2 netcat procps sudo unzip zlib1g
|
||||||
|
RUN /build/bitnami-user.sh && \
|
||||||
|
/build/install-nami.sh
|
||||||
|
RUN bitnami-pkg install sequelize-cli-5.5.1-0 --checksum 7e572fea880336f69bf7b0b34cd718ee81e7114fe61313acaba12b7a5564cddc
|
||||||
|
RUN bitnami-pkg install node-10.18.1-0 --checksum 16a8470725407d4f9262681a284e7eb3241600d414a13458fb635ab983bd09ff
|
||||||
|
RUN bitnami-pkg install git-2.25.0-0 --checksum 392bea1a8c3607f8ebce5403ec22819915ab8a5cc2245a5249568660b4ed07df
|
||||||
|
RUN bitnami-pkg install express-generator-4.16.1-0 --checksum 09dc5947a709a9bbeb257b17cd13bdb2ca87b08fa17baab4583bdc026badef35
|
||||||
|
RUN bitnami-pkg install express-4.17.1-0 --checksum e90ac676893a1c1edaf31f5bac8b9f951ea00405a6c54613b8e3882ccbad6c3c
|
||||||
|
RUN bitnami-pkg install bower-1.8.8-0 --checksum 587140d73a26e13c179f65e09b4cd706db000ff9beb68a57f2158aefa86ce4fa
|
||||||
|
RUN apt-get update && apt-get upgrade && \
|
||||||
|
rm -r /var/lib/apt/lists /var/cache/apt/archives
|
||||||
|
RUN mkdir -p /dist /app /.npm /.config /.cache /.local && chmod g+rwx /dist /app /.npm /.config /.cache /.local
|
||||||
|
RUN /build/install-gosu.sh
|
||||||
|
RUN /build/install-tini.sh
|
||||||
|
|
||||||
|
COPY rootfs /
|
||||||
|
ENV BITNAMI_APP_NAME="express" \
|
||||||
|
BITNAMI_IMAGE_VERSION="4.17.1-debian-10-r0" \
|
||||||
|
NAMI_PREFIX="/.nami"
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
USER 1001
|
||||||
|
ENTRYPOINT [ "/app-entrypoint.sh" ]
|
||||||
|
CMD [ "npm", "start" ]
|
||||||
25
bitnami/express/4/debian-10/docker-compose.yml
Normal file
25
bitnami/express/4/debian-10/docker-compose.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
mongodb:
|
||||||
|
image: 'bitnami/mongodb:4.2'
|
||||||
|
|
||||||
|
express:
|
||||||
|
tty: true # Enables debugging capabilities when attached to this container.
|
||||||
|
image: 'bitnami/express:4'
|
||||||
|
command: npm start
|
||||||
|
environment:
|
||||||
|
- PORT=3000
|
||||||
|
- NODE_ENV=development
|
||||||
|
- DATABASE_URL=mongodb://mongodb:27017/myapp
|
||||||
|
|
||||||
|
- SKIP_DB_WAIT=0
|
||||||
|
- SKIP_DB_MIGRATION=0
|
||||||
|
- SKIP_NPM_INSTALL=0
|
||||||
|
- SKIP_BOWER_INSTALL=0
|
||||||
|
depends_on:
|
||||||
|
- mongodb
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
6
bitnami/express/4/debian-10/prebuildfs/build/bitnami-user.sh
Executable file
6
bitnami/express/4/debian-10/prebuildfs/build/bitnami-user.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
useradd -ms /bin/bash bitnami
|
||||||
|
mkdir -p /opt/bitnami && chown bitnami:bitnami /opt/bitnami
|
||||||
|
sed -i -e 's/\s*Defaults\s*secure_path\s*=/# Defaults secure_path=/' /etc/sudoers
|
||||||
|
echo 'bitnami ALL=NOPASSWD: ALL' >> /etc/sudoers
|
||||||
10
bitnami/express/4/debian-10/prebuildfs/build/install-gosu.sh
Executable file
10
bitnami/express/4/debian-10/prebuildfs/build/install-gosu.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
VERSION="1.11"
|
||||||
|
SHA256="0b843df6d86e270c5b0f5cbd3c326a04e18f4b7f9b8457fa497b0454c4b138d7"
|
||||||
|
|
||||||
|
curl --silent -L "https://github.com/tianon/gosu/releases/download/${VERSION}/gosu-amd64" > "/usr/local/bin/gosu"
|
||||||
|
echo "$SHA256" "/usr/local/bin/gosu" | sha256sum --check
|
||||||
|
chmod u+x "/usr/local/bin/gosu"
|
||||||
|
mkdir -p "/opt/bitnami/licenses"
|
||||||
|
curl --silent -L "https://raw.githubusercontent.com/tianon/gosu/master/LICENSE" > "/opt/bitnami/licenses/gosu-${VERSION}.txt"
|
||||||
7
bitnami/express/4/debian-10/prebuildfs/build/install-nami.sh
Executable file
7
bitnami/express/4/debian-10/prebuildfs/build/install-nami.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
curl --silent -L https://nami-prod.s3.amazonaws.com/tools/nami/releases/nami-1.0.0-1-linux-x64.tar.gz > /tmp/nami-linux-x64.tar.gz
|
||||||
|
echo "80488279b056d5e9c183fe34097c5f496715ab16a602afcc9f78d59f15139a16 /tmp/nami-linux-x64.tar.gz" | sha256sum --check
|
||||||
|
mkdir -p /opt/bitnami/nami /opt/bitnami/licenses
|
||||||
|
tar xzf /tmp/nami-linux-x64.tar.gz --strip 1 -C /opt/bitnami/nami && rm /tmp/nami-linux-x64.tar.gz
|
||||||
|
curl --silent -L https://raw.githubusercontent.com/bitnami/nami/master/COPYING > /opt/bitnami/licenses/nami-1.0.0-1.txt
|
||||||
17
bitnami/express/4/debian-10/prebuildfs/build/install-tini.sh
Executable file
17
bitnami/express/4/debian-10/prebuildfs/build/install-tini.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
GPG_KEY="595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7"
|
||||||
|
GPG_KEY_FINGERPRINT="6380 DC42 8747 F6C3 93FE ACA5 9A84 159D 7001 A4E5"
|
||||||
|
SERVERS=("ha.pool.sks-keyservers.net" "hkp://p80.pool.sks-keyservers.net:80" "keyserver.ubuntu.com" "hkp://keyserver.ubuntu.com:80" "pgp.mit.edu")
|
||||||
|
VERSION="0.13.2"
|
||||||
|
|
||||||
|
for server in "${SERVERS[@]}"; do
|
||||||
|
gpg --keyserver "$server" --recv-keys "$GPG_KEY" && break || :
|
||||||
|
done
|
||||||
|
gpg --fingerprint "$GPG_KEY" | grep -q "$GPG_KEY_FINGERPRINT"
|
||||||
|
curl --silent -L "https://github.com/krallin/tini/releases/download/v${VERSION}/tini.asc" > "/tmp/tini.asc"
|
||||||
|
curl --silent -L "https://github.com/krallin/tini/releases/download/v${VERSION}/tini" > "/usr/local/bin/tini"
|
||||||
|
gpg --verify "/tmp/tini.asc" "/usr/local/bin/tini"
|
||||||
|
chmod +x "/usr/local/bin/tini"
|
||||||
|
mkdir -p "/opt/bitnami/licenses"
|
||||||
|
curl --silent -L "https://raw.githubusercontent.com/krallin/tini/master/LICENSE" > "/opt/bitnami/licenses/tini-${VERSION}.txt"
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
[[ ${BASH_DEBUG:-false} = true ]] && set -x
|
||||||
|
|
||||||
|
# Constants
|
||||||
|
MODULE="$(basename "$0")"
|
||||||
|
BITNAMI_PREFIX=/opt/bitnami
|
||||||
|
|
||||||
|
# Color Palette
|
||||||
|
RESET='\033[0m'
|
||||||
|
BOLD='\033[1m'
|
||||||
|
|
||||||
|
## Foreground
|
||||||
|
BLACK='\033[38;5;0m'
|
||||||
|
RED='\033[38;5;1m'
|
||||||
|
GREEN='\033[38;5;2m'
|
||||||
|
YELLOW='\033[38;5;3m'
|
||||||
|
BLUE='\033[38;5;4m'
|
||||||
|
MAGENTA='\033[38;5;5m'
|
||||||
|
CYAN='\033[38;5;6m'
|
||||||
|
WHITE='\033[38;5;7m'
|
||||||
|
|
||||||
|
## Background
|
||||||
|
ON_BLACK='\033[48;5;0m'
|
||||||
|
ON_RED='\033[48;5;1m'
|
||||||
|
ON_GREEN='\033[48;5;2m'
|
||||||
|
ON_YELLOW='\033[48;5;3m'
|
||||||
|
ON_BLUE='\033[48;5;4m'
|
||||||
|
ON_MAGENTA='\033[48;5;5m'
|
||||||
|
ON_CYAN='\033[48;5;6m'
|
||||||
|
ON_WHITE='\033[48;5;7m'
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
|
||||||
|
########################
|
||||||
|
# Print to STDERR
|
||||||
|
# Arguments:
|
||||||
|
# Message to print
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
#########################
|
||||||
|
stderr_print() {
|
||||||
|
printf "%b\\n" "${*}" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
########################
|
||||||
|
# Log message
|
||||||
|
# Arguments:
|
||||||
|
# Message to log
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
#########################
|
||||||
|
log() {
|
||||||
|
stderr_print "${NAMI_DEBUG:+${CYAN}${MODULE:-} ${MAGENTA}$(date "+%T.%2N ")}${RESET}${*}"
|
||||||
|
}
|
||||||
|
########################
|
||||||
|
# Log an 'info' message
|
||||||
|
# Arguments:
|
||||||
|
# Message to log
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
#########################
|
||||||
|
info() {
|
||||||
|
log "${GREEN}INFO ${RESET} ==> ${*}"
|
||||||
|
}
|
||||||
|
########################
|
||||||
|
# Log message
|
||||||
|
# Arguments:
|
||||||
|
# Message to log
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
#########################
|
||||||
|
warn() {
|
||||||
|
log "${YELLOW}WARN ${RESET} ==> ${*}"
|
||||||
|
}
|
||||||
|
########################
|
||||||
|
# Log an 'error' message
|
||||||
|
# Arguments:
|
||||||
|
# Message to log
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
#########################
|
||||||
|
error() {
|
||||||
|
log "${RED}ERROR${RESET} ==> ${*}"
|
||||||
|
}
|
||||||
|
########################
|
||||||
|
# Print the welcome page
|
||||||
|
# Globals:
|
||||||
|
# DISABLE_WELCOME_MESSAGE
|
||||||
|
# BITNAMI_APP_NAME
|
||||||
|
# Arguments:
|
||||||
|
# None
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
#########################
|
||||||
|
print_welcome_page() {
|
||||||
|
if [[ -z "${DISABLE_WELCOME_MESSAGE:-}" ]]; then
|
||||||
|
if [[ -n "$BITNAMI_APP_NAME" ]]; then
|
||||||
|
print_image_welcome_page
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
########################
|
||||||
|
# Print the welcome page for a Bitnami Docker image
|
||||||
|
# Globals:
|
||||||
|
# BITNAMI_APP_NAME
|
||||||
|
# Arguments:
|
||||||
|
# None
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
#########################
|
||||||
|
print_image_welcome_page() {
|
||||||
|
local github_url="https://github.com/bitnami/bitnami-docker-${BITNAMI_APP_NAME}"
|
||||||
|
|
||||||
|
log ""
|
||||||
|
log "${BOLD}Welcome to the Bitnami ${BITNAMI_APP_NAME} container${RESET}"
|
||||||
|
log "Subscribe to project updates by watching ${BOLD}${github_url}${RESET}"
|
||||||
|
log "Submit issues and feature requests at ${BOLD}${github_url}/issues${RESET}"
|
||||||
|
log "Send us your feedback at ${BOLD}containers@bitnami.com${RESET}"
|
||||||
|
log ""
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /opt/bitnami/base/functions
|
||||||
|
|
||||||
|
########################
|
||||||
|
# Helper function to initialize a single nami module
|
||||||
|
# Arguments:
|
||||||
|
# Module to initialize
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
# Description:
|
||||||
|
# Initialize an unpacked nami module with the `nami initialize` command.
|
||||||
|
# Command arguments can be specified as function argumnts after the module name.
|
||||||
|
# `--log-level trace` flag is added to the command if `NAMI_DEBUG` env variable exists.
|
||||||
|
# The log level can be overriden using the `NAMI_LOG_LEVEL` env variable.
|
||||||
|
#########################
|
||||||
|
nami_initialize_one() {
|
||||||
|
local module="${1:?module not specified}"
|
||||||
|
if nami inspect $module | grep -q '"lifecycle": "unpacked"'; then
|
||||||
|
local inputs=
|
||||||
|
if [[ -f "/${module}-inputs.json" ]]; then
|
||||||
|
inputs="--inputs-file=/${module}-inputs.json"
|
||||||
|
fi
|
||||||
|
nami ${NAMI_DEBUG:+--log-level ${NAMI_LOG_LEVEL:-trace}} initialize $module $inputs "${@:2}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
########################
|
||||||
|
# Helper function to initialize one or more nami modules
|
||||||
|
# Arguments:
|
||||||
|
# Module to initialize
|
||||||
|
# Returns:
|
||||||
|
# None
|
||||||
|
#########################
|
||||||
|
nami_initialize() {
|
||||||
|
local module="${1:?module not specified}"
|
||||||
|
for module in "${@}"; do
|
||||||
|
nami_initialize_one $module
|
||||||
|
done
|
||||||
|
}
|
||||||
211
bitnami/express/4/debian-10/prebuildfs/usr/sbin/bitnami-pkg
Executable file
211
bitnami/express/4/debian-10/prebuildfs/usr/sbin/bitnami-pkg
Executable file
@@ -0,0 +1,211 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
. /opt/bitnami/base/functions
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
log "Usage: bitnami-pkg <COMMAND> <PACKAGE>-<VERSION> [OPTIONS] -- [ARGS]"
|
||||||
|
log ""
|
||||||
|
log "Download and install Bitnami packages"
|
||||||
|
log ""
|
||||||
|
log "Commands:"
|
||||||
|
log " install Download and install a package."
|
||||||
|
log " unpack Download and unpack a package."
|
||||||
|
log ""
|
||||||
|
log "Options:"
|
||||||
|
log " -b, --bucket Package release bucket (default: stacksmith)."
|
||||||
|
log " -c, --checksum SHA256 verification checksum."
|
||||||
|
log " -h, --help Show this help message and exit."
|
||||||
|
log ""
|
||||||
|
log "If the package is already available in the /tmp/bitnami/pkg/cache/"
|
||||||
|
log "directory, the download will be skipped. If there is a corresponding"
|
||||||
|
log "file of the same name post-fixed with .sha256 in the directory,"
|
||||||
|
log "that sha will be used instead of the --checksum option."
|
||||||
|
log ""
|
||||||
|
log "Examples:"
|
||||||
|
log " - Unpack package"
|
||||||
|
log " \$ bitnami-pkg unpack nginx-1.9.10-0"
|
||||||
|
log ""
|
||||||
|
log " - Verify and Install package"
|
||||||
|
log " \$ bitnami-pkg install nginx-1.9.10-0 --checksum 15565d06b18c2e3710fc08e579ddb3d0e39aa663264a0f7404f0743cb4cdb58d"
|
||||||
|
log ""
|
||||||
|
log " - Install package with arguments"
|
||||||
|
log " \$ bitnami-pkg install mariadb-10.1.11-0 -- --password bitnami"
|
||||||
|
log ""
|
||||||
|
log " - Install package from testing"
|
||||||
|
log " \$ bitnami-pkg install mariadb-10.1.11-0 --bucket testing"
|
||||||
|
log ""
|
||||||
|
}
|
||||||
|
|
||||||
|
identify_distro() {
|
||||||
|
distro="${IMAGE_OS:-unknown}"
|
||||||
|
if [ "${distro}" == "unknown" -a -f /etc/os-release ]; then
|
||||||
|
distro="$(grep "^ID=" /etc/os-release | cut -d'=' -f2 | cut -d'"' -f2)-$(grep "^VERSION_ID=" /etc/os-release | cut -d'=' -f2 | cut -d'"' -f2 | cut -d'.' -f1)"
|
||||||
|
fi
|
||||||
|
echo "$distro"
|
||||||
|
}
|
||||||
|
|
||||||
|
identify_arch() {
|
||||||
|
local arch=$(uname -m)
|
||||||
|
|
||||||
|
case "${arch}" in
|
||||||
|
ppc64le)
|
||||||
|
;; # no-op
|
||||||
|
x86_64)
|
||||||
|
case $(identify_distro) in
|
||||||
|
debian-*)
|
||||||
|
arch=amd64
|
||||||
|
;;
|
||||||
|
ol-*)
|
||||||
|
arch=x86_64
|
||||||
|
;;
|
||||||
|
centos-*)
|
||||||
|
arch=x86_64
|
||||||
|
;;
|
||||||
|
rhel-*)
|
||||||
|
arch=x86_64
|
||||||
|
;;
|
||||||
|
photon-*)
|
||||||
|
arch=x86_64
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
arch="unknown"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo $arch
|
||||||
|
}
|
||||||
|
|
||||||
|
# break up command line for easy parsing and check legal options
|
||||||
|
ARGS=$(getopt -o b:c:h -l "bucket:,checksum:,help" -n "bitnami-pkg" -- "$@")
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval set -- "$ARGS";
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
-b|--bucket)
|
||||||
|
shift
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
RELEASE_BUCKET=$1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
-c|--checksum)
|
||||||
|
shift
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
PACKAGE_SHA256=$1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
print_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# weed out unrecognized commands
|
||||||
|
case "$1" in
|
||||||
|
install|unpack) ;;
|
||||||
|
*)
|
||||||
|
error "Unrecognized command: $1"
|
||||||
|
print_usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# install/unpack command need to be supplied a package name
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
print_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
INSTALL_ROOT=/tmp/bitnami/pkg/install
|
||||||
|
CACHE_ROOT=/tmp/bitnami/pkg/cache
|
||||||
|
|
||||||
|
PACKAGE="$2-linux-$(identify_arch)-$(identify_distro)"
|
||||||
|
PACKAGE_ARGS=${@:3}
|
||||||
|
PACKAGE_NAME=$(echo $PACKAGE | sed 's/-[0-9].*//')
|
||||||
|
RELEASE_BUCKET=${RELEASE_BUCKET:-stacksmith}
|
||||||
|
|
||||||
|
mkdir -p $INSTALL_ROOT
|
||||||
|
cd $INSTALL_ROOT
|
||||||
|
|
||||||
|
info "Downloading $PACKAGE package"
|
||||||
|
if [ -f $CACHE_ROOT/$PACKAGE.tar.gz ]; then
|
||||||
|
info "$CACHE_ROOT/$PACKAGE.tar.gz already exists, skipping download."
|
||||||
|
cp $CACHE_ROOT/$PACKAGE.tar.gz .
|
||||||
|
if [ -f $CACHE_ROOT/$PACKAGE.tar.gz.sha256 ]; then
|
||||||
|
info "Using the local sha256 from $CACHE_ROOT/$PACKAGE.tar.gz.sha256"
|
||||||
|
PACKAGE_SHA256=$(cat $CACHE_ROOT/$PACKAGE.tar.gz.sha256)
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# display cURL progress bar when a tty is attached
|
||||||
|
if tty -s; then
|
||||||
|
CURL_ARGS="-#"
|
||||||
|
else
|
||||||
|
CURL_ARGS="-sS"
|
||||||
|
fi
|
||||||
|
if ! curl $CURL_ARGS -LOf "https://downloads.bitnami.com/files/$RELEASE_BUCKET/$PACKAGE.tar.gz"; then
|
||||||
|
warn "Package name '$PACKAGE' does not exist, will try '${PACKAGE%-$(identify_distro)}'..."
|
||||||
|
if curl $CURL_ARGS -LOf "https://downloads.bitnami.com/files/$RELEASE_BUCKET/${PACKAGE%-$(identify_distro)}.tar.gz"; then
|
||||||
|
PACKAGE="${PACKAGE%-$(identify_distro)}"
|
||||||
|
else
|
||||||
|
error "Could not find the requested package..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! tar tzf $PACKAGE.tar.gz >/dev/null 2>&1; then
|
||||||
|
error "Invalid or corrupt '$PACKAGE' package."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$PACKAGE_SHA256" ]; then
|
||||||
|
info "Verifying package integrity"
|
||||||
|
echo "$PACKAGE_SHA256 $PACKAGE.tar.gz" | sha256sum -c -
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the tarball has too many files, it can trigger a bug
|
||||||
|
# in overlayfs when using tar. Install bsdtar in the container image
|
||||||
|
# to workaround it. As the overhead is too big (~40 MB), it is not added by
|
||||||
|
# default. Source: https://github.com/coreos/bugs/issues/1095
|
||||||
|
if which bsdtar > /dev/null; then
|
||||||
|
bsdtar -xf $PACKAGE.tar.gz
|
||||||
|
else
|
||||||
|
tar xzf $PACKAGE.tar.gz
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
install) info "Installing $PACKAGE" ;;
|
||||||
|
unpack) info "Unpacking $PACKAGE" ;;
|
||||||
|
esac
|
||||||
|
nami $1 $PACKAGE $PACKAGE_ARGS
|
||||||
|
|
||||||
|
rm -rf $INSTALL_ROOT
|
||||||
|
|
||||||
|
if [ "$BITNAMI_PKG_EXTRA_DIRS" ]; then
|
||||||
|
info "Creating extra directories"
|
||||||
|
for i in ${BITNAMI_PKG_EXTRA_DIRS}; do
|
||||||
|
mkdir -p $i
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$BITNAMI_PKG_CHMOD" ]; then
|
||||||
|
DIRS="/.nami /bitnami $BITNAMI_PKG_EXTRA_DIRS"
|
||||||
|
if ! [[ $PACKAGE_NAME =~ .*-client ]]; then
|
||||||
|
mkdir -p /bitnami/$PACKAGE_NAME
|
||||||
|
fi
|
||||||
|
# We need to be in $HOME in order to nami inspect works
|
||||||
|
cd $HOME
|
||||||
|
DIRS+=" $(nami inspect $PACKAGE_NAME | grep -e 'installdir' | cut -f4 -d\")"
|
||||||
|
info "Fixing permissions: chmod $BITNAMI_PKG_CHMOD $DIRS"
|
||||||
|
chmod $BITNAMI_PKG_CHMOD $DIRS
|
||||||
|
fi
|
||||||
40
bitnami/express/4/debian-10/rootfs/app-entrypoint.sh
Executable file
40
bitnami/express/4/debian-10/rootfs/app-entrypoint.sh
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
. /opt/bitnami/base/functions
|
||||||
|
. /opt/bitnami/base/helpers
|
||||||
|
|
||||||
|
print_welcome_page
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /opt/bitnami/express/functions
|
||||||
|
|
||||||
|
if [ "$1" = npm ] && [ "$2" = "start" -o "$2" = "run" ]; then
|
||||||
|
bootstrap_express_app
|
||||||
|
|
||||||
|
add_dockerfile
|
||||||
|
|
||||||
|
install_packages
|
||||||
|
|
||||||
|
wait_for_db
|
||||||
|
|
||||||
|
if ! fresh_container; then
|
||||||
|
echo "#########################################################################"
|
||||||
|
echo " "
|
||||||
|
echo " App initialization skipped:"
|
||||||
|
echo " Delete the file $INIT_SEM and restart the container to reinitialize"
|
||||||
|
echo " You can alternatively run specific commands using docker-compose exec"
|
||||||
|
echo " e.g docker-compose exec myapp npm install angular"
|
||||||
|
echo " "
|
||||||
|
echo "#########################################################################"
|
||||||
|
else
|
||||||
|
# Perform any app initialization tasks here.
|
||||||
|
log "Initialization finished"
|
||||||
|
fi
|
||||||
|
|
||||||
|
migrate_db
|
||||||
|
|
||||||
|
touch "$INIT_SEM"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
exec tini -- "$@"
|
||||||
4
bitnami/express/4/debian-10/rootfs/dist/.dockerignore
vendored
Normal file
4
bitnami/express/4/debian-10/rootfs/dist/.dockerignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.git/
|
||||||
|
node_modules/
|
||||||
|
.gitignore
|
||||||
|
docker-compose.yml
|
||||||
1
bitnami/express/4/debian-10/rootfs/dist/.gitignore
vendored
Normal file
1
bitnami/express/4/debian-10/rootfs/dist/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
||||||
23
bitnami/express/4/debian-10/rootfs/dist/Dockerfile.tpl
vendored
Normal file
23
bitnami/express/4/debian-10/rootfs/dist/Dockerfile.tpl
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
## Dockerfile for building production image
|
||||||
|
FROM bitnami/express:{{BITNAMI_IMAGE_VERSION}}
|
||||||
|
LABEL maintainer "John Smith <john.smith@acme.com>"
|
||||||
|
|
||||||
|
ENV DISABLE_WELCOME_MESSAGE=1
|
||||||
|
|
||||||
|
ENV NODE_ENV=production \
|
||||||
|
PORT=3000
|
||||||
|
|
||||||
|
# Skip fetching dependencies and database migrations for production image
|
||||||
|
ENV SKIP_DB_WAIT=0 \
|
||||||
|
SKIP_DB_MIGRATION=1 \
|
||||||
|
SKIP_NPM_INSTALL=1 \
|
||||||
|
SKIP_BOWER_INSTALL=1
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
RUN sudo chown -R bitnami: /app
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
RUN bower install
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
CMD ["npm", "start"]
|
||||||
19
bitnami/express/4/debian-10/rootfs/dist/samples/mariadb.js
vendored
Normal file
19
bitnami/express/4/debian-10/rootfs/dist/samples/mariadb.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
Note: Generated by Bitnami:
|
||||||
|
Configuration file that shows how to use the built in MySQL database in your project.
|
||||||
|
Based on the examples found here: https://github.com/mysqljs/mysql
|
||||||
|
*/
|
||||||
|
|
||||||
|
var mysql = require('mysql')
|
||||||
|
, assert = require('assert');;
|
||||||
|
|
||||||
|
// Connection URL configured in your docker-compose.yml file
|
||||||
|
var url = process.env.DATABASE_URL;
|
||||||
|
|
||||||
|
var connection = mysql.createConnection(url);
|
||||||
|
connection.connect(function(err) {
|
||||||
|
assert.equal(null, err);
|
||||||
|
console.log("Connected correctly to MySQL server");
|
||||||
|
connection.query('SHOW TABLES;');
|
||||||
|
connection.end();
|
||||||
|
});
|
||||||
20
bitnami/express/4/debian-10/rootfs/dist/samples/mongodb.js
vendored
Normal file
20
bitnami/express/4/debian-10/rootfs/dist/samples/mongodb.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Note: Generated by Bitnami:
|
||||||
|
Configuration file that shows how to use the built in MongoDB database in your project.
|
||||||
|
Based on the examples found here: https://github.com/mongodb/node-mongodb-native
|
||||||
|
|
||||||
|
If you want to use an ODM instead of barebone Node connections, you can install Mongoose
|
||||||
|
https://www.npmjs.com/package/mongoose
|
||||||
|
*/
|
||||||
|
|
||||||
|
var MongoClient = require('mongodb').MongoClient
|
||||||
|
, assert = require('assert');
|
||||||
|
|
||||||
|
// Connection URL configured in your docker-compose.yml file
|
||||||
|
var url = process.env.DATABASE_URL;
|
||||||
|
|
||||||
|
MongoClient.connect(url, function(err, db) {
|
||||||
|
assert.equal(null, err);
|
||||||
|
console.log("Connected correctly to MongoDB server");
|
||||||
|
db.close();
|
||||||
|
});
|
||||||
150
bitnami/express/4/debian-10/rootfs/opt/bitnami/express/functions
Normal file
150
bitnami/express/4/debian-10/rootfs/opt/bitnami/express/functions
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
. /opt/bitnami/base/functions
|
||||||
|
|
||||||
|
INIT_SEM=/tmp/initialized.sem
|
||||||
|
PACKAGE_FILE=/app/package.json
|
||||||
|
|
||||||
|
fresh_container() {
|
||||||
|
[ ! -f $INIT_SEM ]
|
||||||
|
}
|
||||||
|
|
||||||
|
app_present() {
|
||||||
|
[ -f package.json ]
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies_up_to_date() {
|
||||||
|
# It it up to date if the package file is older than
|
||||||
|
# the last time the container was initialized
|
||||||
|
[ ! $PACKAGE_FILE -nt $INIT_SEM ]
|
||||||
|
}
|
||||||
|
|
||||||
|
database_tier_exists() {
|
||||||
|
[ -n "$(getent hosts mongodb mysql mariadb postgresql)" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
__wait_for_db() {
|
||||||
|
local host=$1
|
||||||
|
local port=$2
|
||||||
|
local ip_address
|
||||||
|
ip_address=$(getent hosts "$1" | awk '{ print $1 }')
|
||||||
|
|
||||||
|
info "Connecting to at $host server at $ip_address:$port."
|
||||||
|
|
||||||
|
counter=0
|
||||||
|
until nc -z "$ip_address" "$port"; do
|
||||||
|
counter=$((counter+1))
|
||||||
|
if [ $counter == 10 ]; then
|
||||||
|
error "Couldn't connect to $host server."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
info "Trying to connect to $host server at $ip_address:$port. Attempt $counter."
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
info "Connected to $host server."
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for_db() {
|
||||||
|
if ! [[ -n $SKIP_DB_WAIT && $SKIP_DB_WAIT -gt 0 ]] && database_tier_exists ; then
|
||||||
|
if getent hosts mongodb >/dev/null; then
|
||||||
|
__wait_for_db mongodb 27017
|
||||||
|
fi
|
||||||
|
|
||||||
|
if getent hosts mariadb >/dev/null; then
|
||||||
|
__wait_for_db mariadb 3306
|
||||||
|
fi
|
||||||
|
|
||||||
|
if getent hosts mysql >/dev/null; then
|
||||||
|
__wait_for_db mysql 3306
|
||||||
|
fi
|
||||||
|
|
||||||
|
if getent hosts postgresql >/dev/null; then
|
||||||
|
__wait_for_db postgresql 5432
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_gitignore_sample() {
|
||||||
|
info "Installing git ignore rules."
|
||||||
|
cp /dist/.gitignore .gitignore
|
||||||
|
}
|
||||||
|
|
||||||
|
add_sample_code() {
|
||||||
|
if ! [[ -n $SKIP_SAMPLE_CODE && $SKIP_SAMPLE_CODE -gt 0 ]]; then
|
||||||
|
info "Adding dist samples."
|
||||||
|
cp -r /dist/samples .
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_database_support() {
|
||||||
|
if database_tier_exists; then
|
||||||
|
if getent hosts mongodb >/dev/null && ! npm ls mongodb >/dev/null; then
|
||||||
|
info "Adding mongodb npm module."
|
||||||
|
npm install --save mongodb
|
||||||
|
fi
|
||||||
|
|
||||||
|
if getent hosts mariadb >/dev/null && ! npm ls mysql >/dev/null || getent hosts mysql >/dev/null && ! npm ls mysql >/dev/null; then
|
||||||
|
info "Adding mysql npm module."
|
||||||
|
npm install --save mysql
|
||||||
|
fi
|
||||||
|
|
||||||
|
if getent hosts postgresql >/dev/null && ! npm ls pg pg-hstore >/dev/null; then
|
||||||
|
info "Adding pg pg-hstore npm modules."
|
||||||
|
npm install --save pg pg-hstore
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_nodemon_support() {
|
||||||
|
info "Adding nodemon npm module (dev)."
|
||||||
|
npm install nodemon --save-dev
|
||||||
|
sed -i 's;"start".*;"start": "node ./bin/www", "development": "nodemon ./bin/www";' package.json
|
||||||
|
}
|
||||||
|
|
||||||
|
bootstrap_express_app() {
|
||||||
|
if ! app_present; then
|
||||||
|
info "Creating express application."
|
||||||
|
express . -f
|
||||||
|
mkdir -p tmp
|
||||||
|
mkdir -p logs
|
||||||
|
chmod og+rw -R tmp logs
|
||||||
|
add_gitignore_sample
|
||||||
|
add_database_support
|
||||||
|
add_nodemon_support
|
||||||
|
add_sample_code
|
||||||
|
else
|
||||||
|
info "Skipping creation of new application. Already exists!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_dockerfile() {
|
||||||
|
if [[ ! -f Dockerfile ]]; then
|
||||||
|
cp -r /dist/Dockerfile.tpl Dockerfile
|
||||||
|
sed -i 's/{{BITNAMI_IMAGE_VERSION}}/'"$BITNAMI_IMAGE_VERSION"'/g' Dockerfile
|
||||||
|
[[ ! -f bower.json ]] && sed -i '/^RUN bower install/d' Dockerfile
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f .dockerignore ]]; then
|
||||||
|
cp -r /dist/.dockerignore .
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_packages() {
|
||||||
|
if ! dependencies_up_to_date; then
|
||||||
|
if ! [[ -n $SKIP_NPM_INSTALL && $SKIP_NPM_INSTALL -gt 0 ]] && [[ -f package.json ]]; then
|
||||||
|
info "Installing npm packages."
|
||||||
|
npm install
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ -n $SKIP_BOWER_INSTALL && $SKIP_BOWER_INSTALL -gt 0 ]] && [[ -f bower.json ]]; then
|
||||||
|
info "Installing bower packages."
|
||||||
|
bower install
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
migrate_db() {
|
||||||
|
if ! [[ -n $SKIP_DB_MIGRATE && $SKIP_DB_MIGRATE -gt 0 ]] && [[ -f .sequelizerc ]]; then
|
||||||
|
info "Applying database migrations (sequelize db:migrate)."
|
||||||
|
sequelize db:migrate
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -43,7 +43,7 @@ Learn more about the Bitnami tagging policy and the difference between rolling t
|
|||||||
|
|
||||||
|
|
||||||
* [`4-ol-7`, `4.17.1-ol-7-r223` (4/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-express/blob/4.17.1-ol-7-r223/4/ol-7/Dockerfile)
|
* [`4-ol-7`, `4.17.1-ol-7-r223` (4/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-express/blob/4.17.1-ol-7-r223/4/ol-7/Dockerfile)
|
||||||
* [`4-debian-10`, `0.0.0-debian-10-r0`, `4`, `0.0.0`, `0.0.0-r0`, `latest` (4/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-express/blob/0.0.0-debian-10-r0/4/debian-10/Dockerfile)
|
* [`4-debian-10`, `4.17.1-debian-10-r0`, `4`, `4.17.1`, `4.17.1-r0`, `latest` (4/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-express/blob/4.17.1-debian-10-r0/4/debian-10/Dockerfile)
|
||||||
|
|
||||||
Subscribe to project updates by watching the [bitnami/codiad GitHub repo](https://github.com/bitnami/bitnami-docker-codiad).
|
Subscribe to project updates by watching the [bitnami/codiad GitHub repo](https://github.com/bitnami/bitnami-docker-codiad).
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: '2'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mongodb:
|
mongodb:
|
||||||
image: 'bitnami/mongodb:4.0'
|
image: 'bitnami/mongodb:4.2'
|
||||||
|
|
||||||
express:
|
express:
|
||||||
tty: true # Enables debugging capabilities when attached to this container.
|
tty: true # Enables debugging capabilities when attached to this container.
|
||||||
|
|||||||
Reference in New Issue
Block a user