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