mirror of
https://github.com/bitnami/containers.git
synced 2026-03-19 15:57:46 +08:00
4.16.3-debian-9-r0 release
Add Oracle Linux support
This commit is contained in:
24
bitnami/express/4/debian-9/Dockerfile
Normal file
24
bitnami/express/4/debian-9/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
||||
FROM bitnami/minideb-extras:stretch-r71
|
||||
LABEL maintainer "Bitnami <containers@bitnami.com>"
|
||||
|
||||
ENV BITNAMI_PKG_CHMOD="-R g+rwX" \
|
||||
HOME="/"
|
||||
|
||||
# Install required system packages and dependencies
|
||||
RUN install_packages ghostscript imagemagick libbz2-1.0 libc6 libgcc1 libncurses5 libreadline7 libsqlite3-0 libssl1.1 libstdc++6 libtinfo5 zlib1g
|
||||
RUN bitnami-pkg install node-7.10.1-1 --checksum 53362288e961d298a724353710a31901d4cb8237894a26a2f676b35450c02975
|
||||
RUN bitnami-pkg install express-generator-4.16.0-0 --checksum 713814e0b5a01f398c32f7caaa007c661d28dffc093133decdbdb360433a8742
|
||||
RUN bitnami-pkg install express-4.16.3-1 --checksum 90fae7f6ed904c6a7b0cfe6998456cf4724696ce7dfb46f6777b3df4d594702d
|
||||
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-debian-9-r0" \
|
||||
PATH="/opt/bitnami/node/bin:/opt/bitnami/express/bin:$PATH"
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
WORKDIR /app
|
||||
USER 1001
|
||||
ENTRYPOINT ["/app-entrypoint.sh"]
|
||||
CMD ["npm","start"]
|
||||
25
bitnami/express/4/debian-9/docker-compose.yml
Normal file
25
bitnami/express/4/debian-9/docker-compose.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
mongodb:
|
||||
image: 'bitnami/mongodb:latest'
|
||||
|
||||
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
|
||||
39
bitnami/express/4/debian-9/rootfs/app-entrypoint.sh
Executable file
39
bitnami/express/4/debian-9/rootfs/app-entrypoint.sh
Executable 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 -- "$@"
|
||||
4
bitnami/express/4/debian-9/rootfs/dist/.dockerignore
vendored
Normal file
4
bitnami/express/4/debian-9/rootfs/dist/.dockerignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.git/
|
||||
node_modules/
|
||||
.gitignore
|
||||
docker-compose.yml
|
||||
1
bitnami/express/4/debian-9/rootfs/dist/.gitignore
vendored
Normal file
1
bitnami/express/4/debian-9/rootfs/dist/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
23
bitnami/express/4/debian-9/rootfs/dist/Dockerfile.tpl
vendored
Normal file
23
bitnami/express/4/debian-9/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-9/rootfs/dist/samples/mariadb.js
vendored
Normal file
19
bitnami/express/4/debian-9/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-9/rootfs/dist/samples/mongodb.js
vendored
Normal file
20
bitnami/express/4/debian-9/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();
|
||||
});
|
||||
149
bitnami/express/4/debian-9/rootfs/opt/bitnami/express/functions
Normal file
149
bitnami/express/4/debian-9/rootfs/opt/bitnami/express/functions
Normal 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
|
||||
}
|
||||
@@ -23,8 +23,8 @@ $ docker-compose up
|
||||
# Supported tags and respective `Dockerfile` links
|
||||
|
||||
* [`4-ol-7`, `4.16.3-ol-7-r8` (4/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-codiad/blob/4.16.3-ol-7-r8/4/ol-7/Dockerfile)
|
||||
* [`4-debian-9`, `4.16.3-debian-9-r0` (4/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-codiad/blob/4.16.3-debian-9-r0/4/debian-9/Dockerfile)
|
||||
* [`4-debian-8`, `4.16.3-debian-8-r0`, `4`, `4.16.3`, `4.16.3-r0`, `latest` (4/Dockerfile)](https://github.com/bitnami/bitnami-docker-codiad/blob/4.16.3-debian-8-r0/4/Dockerfile)
|
||||
* [`4-debian-9`, `0.0.0-debian-9-r0` (4/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-codiad/blob/0.0.0-debian-9-r0/4/debian-9/Dockerfile)
|
||||
|
||||
Subscribe to project updates by watching the [bitnami/codiad GitHub repo](https://github.com/bitnami/bitnami-docker-codiad).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user