Add Dockerfile for development

This commit is contained in:
Nabil BENDAFI 2018-02-21 13:21:32 +01:00
parent 26dab454b1
commit 02a3d8757a
3 changed files with 54 additions and 0 deletions

25
Dockerfile Normal file
View File

@ -0,0 +1,25 @@
# Dockerfile for GNS3 Web-ui development
FROM node:carbon
RUN npm -g config set user root
RUN npm install -g @angular/cli
# Create user
RUN useradd --user-group --create-home --shell /bin/false gns3-web-ui
# Create app directory
ENV HOME /home/gns3-web-ui
WORKDIR $HOME
# Switch to gns3-web-ui user
USER gns3-web-ui
# Copy source
COPY . .
# Install dependencies
RUN npm install
EXPOSE 8080
CMD ng serve --host 0.0.0.0 --port 8080

View File

@ -34,6 +34,13 @@ ng serve --port 8080
Application is accessible on `http://localhost:8080/`. The app will automatically reload if you change any of the source files.
### Docker container
For development you can run the GNS3 Web UI in a container
.. code:: bash
bash scripts/docker_dev_webui.sh
## Code scaffolding

22
scripts/docker_dev_webui.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
#
# Copyright (C) 2018 GNS3 Technologies Inc.
# Copyright (C) 2018 Nabil Bendafi <nabil@bendafi.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# A docker web UI use for localy test
docker build -t gns3-web-ui .
docker run -i -h gns3UIvm -p 8080:8080/tcp -t gns3-web-ui