Merge pull request #69 from nabilbendafi/master

Add Dockerfile for development
This commit is contained in:
ziajka 2018-02-23 11:08:06 +01:00 committed by GitHub
commit 9b2deb8f21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 0 deletions

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
# Dockerfile for GNS3 Web-ui development
FROM node:carbon
# 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
# Copy source
COPY . .
RUN chown -R gns3-web-ui:gns3-web-ui $HOME
# Switch to gns3-web-ui user
USER gns3-web-ui
# Install dependencies
RUN yarn global add @angular/cli
RUN yarn install --pure-lockfile
ENV PATH /home/gns3-web-ui/.yarn/bin:$PATH
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. 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 ## 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