Merge pull request #109 from bitnami/remove_debian_8
Removed Debian 8 from root version folders
This commit is contained in:
commit
aa7cc18d88
|
|
@ -1,38 +0,0 @@
|
|||
FROM bitnami/minideb-extras:jessie-r24-buildpack
|
||||
|
||||
LABEL maintainer "Bitnami <containers@bitnami.com>"
|
||||
|
||||
# System packages required
|
||||
RUN install_packages ghostscript imagemagick libbz2-1.0 libc6 libgcc1 libmysqlclient18 libncurses5 libreadline6 libsqlite3-0 libssl1.0.0 libstdc++6 libtinfo5 zlib1g netcat-traditional
|
||||
|
||||
# Additional modules required
|
||||
RUN bitnami-pkg install node-7.10.0-0 --checksum 7209e62e60335308287cba38bc18fb34245d41b86bc7ffd3ad26413f186c529b
|
||||
ENV PATH=/opt/bitnami/node/bin:/opt/bitnami/python/bin:$PATH \
|
||||
NODE_PATH=/opt/bitnami/node/lib/node_modules
|
||||
|
||||
RUN bitnami-pkg install express-generator-4.15.0-0 --checksum 28212293bc46e35f3e5638ba3a361fd4cdfcf7be5ee70e0412e8644393255505
|
||||
RUN npm install -g bower@1.8.0 sequelize-cli
|
||||
|
||||
# Install express
|
||||
RUN bitnami-pkg install express-4.15.3-0 --checksum e511a51d76c71a36545c8c7b60ff47e428800dd91a92dc4f67ae7bc65db1b6f3
|
||||
RUN rm -rf /app
|
||||
|
||||
# ExpressJS template
|
||||
ENV BITNAMI_APP_NAME=express
|
||||
ENV BITNAMI_IMAGE_VERSION=4.15.3-r3
|
||||
|
||||
COPY rootfs/ /
|
||||
|
||||
# The extra files that we bundle should use the Bitnami User
|
||||
# so the entrypoint does not have any permission issues
|
||||
RUN mkdir /app && chown bitnami: /app /dist
|
||||
|
||||
USER bitnami
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT ["/app-entrypoint.sh"]
|
||||
|
||||
CMD ["npm", "start"]
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
version: '2'
|
||||
|
||||
services:
|
||||
mongodb:
|
||||
image: bitnami/mongodb:latest
|
||||
|
||||
myapp:
|
||||
tty: true # Enables debugging capabilities when attached to this container.
|
||||
image: 'bitnami/express:4'
|
||||
labels:
|
||||
kompose.service.type: nodeport
|
||||
command: npm run development
|
||||
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
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/bash -e
|
||||
. /opt/bitnami/base/functions
|
||||
. /opt/bitnami/express/functions
|
||||
|
||||
print_welcome_page
|
||||
|
||||
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 -- "$@"
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
.git/
|
||||
node_modules/
|
||||
.gitignore
|
||||
docker-compose.yml
|
||||
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
node_modules/
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
## 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"]
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
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();
|
||||
});
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
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();
|
||||
});
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
#!/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
|
||||
|
||||
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
|
||||
}
|
||||
Loading…
Reference in New Issue