4.16.3-ol-7-r0 release

Add Oracle Linux support
This commit is contained in:
Bitnami Bot
2018-06-28 08:16:35 +00:00
parent 39460b0e77
commit 688315669f
11 changed files with 313 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
FROM bitnami/oraclelinux-extras:7-r19
LABEL maintainer "Bitnami <containers@bitnami.com>"
ENV BITNAMI_PKG_CHMOD="-R g+rwX" \
HOME="/"
# Install required system packages and dependencies
RUN install_packages bzip2-libs glibc keyutils-libs krb5-libs libcom_err libgcc libselinux libstdc++ nc ncurses-libs nss-softokn-freebl openssl-libs pcre readline sqlite zlib
RUN bitnami-pkg install node-7.10.1-1 --checksum c58b53a2ea5feafe1e0f0ef4b990d9ff55c37089ff5fba12e1938183e8a81a2f
RUN bitnami-pkg install express-generator-4.16.0-0 --checksum c7d51fd74deeb5f58b2c6e96ff9343bc80817c9240c937ad01e228322d609463
RUN bitnami-pkg install express-4.16.3-1 --checksum f8d7633ed2081b85afae8d35e0e366bc823fcd85507a151f73fdf176bb38ed71
RUN mkdir -p /dist /app /.npm && chmod g+rwx /app /dist /.npm
COPY rootfs /
ENV BITNAMI_APP_NAME="express" \
BITNAMI_IMAGE_VERSION="4.16.3-ol-7-r0" \
PATH="/opt/bitnami/node/bin:/opt/bitnami/express-generator/bin:/opt/bitnami/express/bin:$PATH"
EXPOSE 3000
WORKDIR /app
USER 1001
ENTRYPOINT ["/app-entrypoint.sh"]
CMD ["npm","start"]

View File

@@ -0,0 +1,25 @@
version: '2'
services:
mongodb:
image: 'bitnami/mongodb:3.6-ol-7'
express:
tty: true # Enables debugging capabilities when attached to this container.
image: 'bitnami/express:4-ol-7'
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

View File

@@ -0,0 +1,39 @@
#!/bin/bash -e
. /opt/bitnami/base/functions
. /opt/bitnami/base/helpers
print_welcome_page
. /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 -- "$@"

View File

@@ -0,0 +1,4 @@
.git/
node_modules/
.gitignore
docker-compose.yml

View File

@@ -0,0 +1 @@
node_modules/

View 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"]

View 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();
});

View 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();
});

View File

@@ -0,0 +1,149 @@
#!/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=$(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
}

View File

@@ -20,6 +20,13 @@ $ docker-compose up
* Bitnami images are built on CircleCI and automatically pushed to the Docker Hub.
* All our images are based on [minideb](https://github.com/bitnami/minideb) a minimalist Debian based container image which gives you a small base container image and the familiarity of a leading linux distribution.
# Supported tags and respective `Dockerfile` links
* [`4`, `4.16.3-r0`, `latest` (4/Dockerfile)](https://github.com/bitnami/bitnami-docker-codiad/blob/4.16.3-r0/4/Dockerfile)
* [`4-ol-7`, `4.16.3-ol-7-r0` (4/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-codiad/blob/4.16.3-ol-7-r0/4/ol-7/Dockerfile)
Subscribe to project updates by watching the [bitnami/codiad GitHub repo](https://github.com/bitnami/bitnami-docker-codiad).
## Introduction
[Express.js](http://expressjs.org/), or simply Express, is a web application framework for [Node.js](https://nodejs.org), released as free and open-source software under the [MIT License](https://github.com/nodejs/node/blob/master/LICENSE).

View File

@@ -7,6 +7,7 @@ jobs:
environment:
RELEASE_SERIES_LIST: "4"
LATEST_STABLE: "4"
DISTRIBUTIONS_LIST: "debian-8,ol-7"
IMAGE_NAME: express
DOCKER_PROJECT: bitnami
QUAY_PROJECT: bitnami
@@ -60,4 +61,4 @@ workflows:
branches:
only: /.*/
tags:
only: /^[0-9].*-r[0-9]+$/
only: /^.*(?<!-rhel-7)-r[0-9]+$/