mirror of
https://github.com/bitnami/containers.git
synced 2026-03-19 15:57:46 +08:00
install bower packages
- renamed `npm_install` function to `install_packages` - execute `bower install` if `bower.json` file exists - added `SKIP_BOWER_INSTALL` entrypoint control param - adds `bower install` to `Dockerfile.tpl`
This commit is contained in:
@@ -18,6 +18,7 @@ services:
|
||||
- SKIP_DB_WAIT=0
|
||||
- SKIP_DB_MIGRATION=0
|
||||
- SKIP_NPM_INSTALL=0
|
||||
- SKIP_BOWER_INSTALL=0
|
||||
depends_on:
|
||||
- mariadb
|
||||
ports:
|
||||
|
||||
@@ -18,6 +18,7 @@ services:
|
||||
- SKIP_DB_WAIT=0
|
||||
- SKIP_DB_MIGRATION=0
|
||||
- SKIP_NPM_INSTALL=0
|
||||
- SKIP_BOWER_INSTALL=0
|
||||
depends_on:
|
||||
- postgresql
|
||||
ports:
|
||||
|
||||
@@ -16,6 +16,7 @@ services:
|
||||
- SKIP_DB_WAIT=0
|
||||
- SKIP_DB_MIGRATION=0
|
||||
- SKIP_NPM_INSTALL=0
|
||||
- SKIP_BOWER_INSTALL=0
|
||||
depends_on:
|
||||
- mongodb
|
||||
ports:
|
||||
|
||||
@@ -85,6 +85,7 @@ 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
|
||||
@@ -92,10 +93,17 @@ add_dockerfile() {
|
||||
fi
|
||||
}
|
||||
|
||||
npm_install() {
|
||||
if ! [[ -n $SKIP_NPM_INSTALL && $SKIP_NPM_INSTALL -gt 0 ]] && [[ -f package.json ]] && ! dependencies_up_to_date; then
|
||||
log "Installing/Updating Express dependencies (npm)"
|
||||
npm install
|
||||
install_packages() {
|
||||
if ! dependencies_up_to_date; then
|
||||
if ! [[ -n $SKIP_NPM_INSTALL && $SKIP_NPM_INSTALL -gt 0 ]] && [[ -f package.json ]]; then
|
||||
log "Installing npm packages"
|
||||
npm install
|
||||
fi
|
||||
|
||||
if ! [[ -n $SKIP_BOWER_INSTALL && $SKIP_BOWER_INSTALL -gt 0 ]] && [[ -f bower.json ]]; then
|
||||
log "Installing bower packages"
|
||||
bower install
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -122,7 +130,7 @@ if [ "$1" == npm ] && [ "$2" == "start" -o "$2" == "run" ]; then
|
||||
|
||||
add_dockerfile
|
||||
|
||||
npm_install
|
||||
install_packages
|
||||
|
||||
if ! fresh_container; then
|
||||
echo "#########################################################################"
|
||||
|
||||
4
bitnami/express/rootfs/dist/Dockerfile.tpl
vendored
4
bitnami/express/rootfs/dist/Dockerfile.tpl
vendored
@@ -10,12 +10,14 @@ ENV NODE_ENV=production \
|
||||
# Skip fetching dependencies and database migrations for production image
|
||||
ENV SKIP_DB_WAIT=0 \
|
||||
SKIP_DB_MIGRATION=1 \
|
||||
SKIP_NPM_INSTALL=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"]
|
||||
|
||||
Reference in New Issue
Block a user