change Dockerfile

add build.sh with build docker
This commit is contained in:
gavinzhou 2016-07-12 01:40:07 +00:00 committed by nixa
parent 44924aefcc
commit 61bf47e16e
3 changed files with 20 additions and 27 deletions

View file

@ -1,33 +1,16 @@
FROM node:latest
COPY . /var/www
WORKDIR /var/www
#Install rimraf globally, so root can perform delete operation
RUN npm install --global rimraf
RUN npm run clean
#install bower and dependcies with --allow-root flag
RUN npm install --global bower
RUN bower install --allow-root
#install right version of typings
RUN npm install --global typings@0.8.1
RUN npm run typings -- install
#install all
RUN npm install --global webpack webpack-dev-server typescript
RUN npm install
#build
RUN npm run prebuild:prod
RUN npm run build:prod
RUN git clone https://github.com/akveo/ng2-admin.git /var/www \
&& cd /var/www \
&& npm install --global rimraf \
&& npm run clean \
&& npm install --global bower typings webpack webpack-dev-server typescript \
&& bower install --allow-root \
&& npm run typings -- install \
&& npm install \
&& npm run prebuild:prod && npm run build:prod
EXPOSE 8080
WORKDIR /var/www
ENTRYPOINT ["npm", "run", "server:prod"]
#to build image - docker quick terminal, navigate to folder, docker build -t [your docker hub account]/ng2-admin .
#to run docker run -p 8080:8080 [your docker hub account]/ng2-admin
#or you can simply pull from my registry - docker pull dimkk/ng2-admin, docker run -p8080:8080 dimkk/ng2-admin
#now you can navigate to docker-machine (assuming you are on windows or osx) in browser - 192.168.99.100:8080

1
_VERSION Normal file
View file

@ -0,0 +1 @@
_VERSION=0.3.0

9
build.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
_tag=$1
if [ -z "${_tag}" ]; then
source _VERSION
_tag=${_VERSION}
fi
docker build --tag "ng2-admin:${_tag}" --no-cache=true .