Matteo Scandolo | fc4b37b | 2017-02-02 12:18:47 -0800 | [diff] [blame] | 1 | # To build use: docker build -t xosproject/xos-sample-gui-extension . |
| 2 | # To run use: docker run -p 4001:4000 -d xosproject/xos-sample-gui-extension |
| 3 | |
| 4 | FROM nginx |
| 5 | |
| 6 | # Set environment vars |
| 7 | ENV CODE_SOURCE . |
| 8 | ENV CODE_DEST /var/www |
| 9 | ENV VHOST /var/www/dist |
| 10 | |
| 11 | # Install nodeJs |
| 12 | RUN apt-get update |
| 13 | RUN apt-get install curl git bzip2 -y |
| 14 | RUN curl -sL https://deb.nodesource.com/setup_4.x > install_node.sh |
| 15 | RUN chmod a+x install_node.sh |
| 16 | RUN ./install_node.sh |
| 17 | RUN apt-get install -y nodejs |
| 18 | |
| 19 | # Add the app deps |
| 20 | COPY ${CODE_SOURCE}/package.json ${CODE_DEST}/package.json |
| 21 | COPY ${CODE_SOURCE}/typings.json ${CODE_DEST}/typings.json |
| 22 | |
| 23 | # Install Deps |
| 24 | WORKDIR ${CODE_DEST} |
| 25 | RUN npm install |
| 26 | RUN npm run typings |
| 27 | |
| 28 | # Create folder for logs |
| 29 | RUN mkdir -p /var/log/nginx/log |
| 30 | |
| 31 | # Build the app |
| 32 | EXPOSE 4000 |
| 33 | COPY ${CODE_SOURCE}/conf ${CODE_DEST}/conf |
| 34 | COPY ${CODE_SOURCE}/gulp_tasks ${CODE_DEST}/gulp_tasks |
| 35 | COPY ${CODE_SOURCE}/src ${CODE_DEST}/src |
| 36 | COPY ${CODE_SOURCE}/gulpfile.js ${CODE_DEST}/gulpfile.js |
| 37 | COPY ${CODE_SOURCE}/tsconfig.json ${CODE_DEST}/tsconfig.json |
| 38 | COPY ${CODE_SOURCE}/tslint.json ${CODE_DEST}/tslint.json |
| 39 | RUN npm run build |
| 40 | |
| 41 | # Override nginx configutaion |
| 42 | COPY ${CODE_SOURCE}/nginx.conf ${CODE_DEST}/nginx.conf |
| 43 | RUN mv ${CODE_SOURCE}/nginx.conf /etc/nginx/conf.d/default.conf |