mirror of
https://github.com/bitnami/containers.git
synced 2026-03-19 15:57:46 +08:00
adds Dockerfile to build immutable application image
This commit is contained in:
@@ -81,6 +81,17 @@ add_sample_code() {
|
||||
fi
|
||||
}
|
||||
|
||||
add_dockerfile() {
|
||||
if [[ ! -f Dockerfile ]]; then
|
||||
cp -r /dist/Dockerfile.tpl Dockerfile
|
||||
sed -i 's/{{BITNAMI_IMAGE_VERSION}}/'"$BITNAMI_IMAGE_VERSION"'/g' Dockerfile
|
||||
fi
|
||||
|
||||
if [[ ! -f .dockerignore ]]; then
|
||||
cp -r /dist/.dockerignore .
|
||||
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)"
|
||||
@@ -109,6 +120,8 @@ if [ "$1" == npm ] && [ "$2" == "start" -o "$2" == "run" ]; then
|
||||
add_sample_code
|
||||
fi
|
||||
|
||||
add_dockerfile
|
||||
|
||||
npm_install
|
||||
|
||||
if ! fresh_container; then
|
||||
|
||||
5
bitnami/express/rootfs/dist/.dockerignore
vendored
Normal file
5
bitnami/express/rootfs/dist/.dockerignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.git/
|
||||
node_modules/
|
||||
.gitignore
|
||||
docker-compose.yml
|
||||
|
||||
31
bitnami/express/rootfs/dist/Dockerfile.tpl
vendored
Normal file
31
bitnami/express/rootfs/dist/Dockerfile.tpl
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
## GENERATED BY bitnami/express:{{BITNAMI_IMAGE_VERSION}} IMAGE
|
||||
## BROUGHT TO YOU BY BITNAMI.
|
||||
##
|
||||
## BUILDING
|
||||
## (from project root directory)
|
||||
## $ docker build -t myapp .
|
||||
##
|
||||
## RUNNING
|
||||
## $ docker run -p 3000:3000 myapp
|
||||
##
|
||||
|
||||
FROM bitnami/express:{{BITNAMI_IMAGE_VERSION}}
|
||||
MAINTAINER john.smith@acme.com
|
||||
|
||||
ENV DISABLE_WELCOME_MESSAGE=1
|
||||
|
||||
ENV NODE_ENV=production \
|
||||
PORT=3000
|
||||
|
||||
# fine tune the behavior of the default entrypoint
|
||||
ENV SKIP_DB_WAIT=0 \
|
||||
SKIP_DB_MIGRATION=1 \
|
||||
SKIP_NPM_INSTALL=1
|
||||
|
||||
COPY . /app
|
||||
RUN sudo chown -R bitnami: /app
|
||||
|
||||
RUN npm install
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["npm", "start"]
|
||||
Reference in New Issue
Block a user