Merge branch 'Deployment' into 'BackendCommunication'

Add Deployment tho the currently used development branch

See merge request scrum-taskboard/frontend!1
This commit is contained in:
ortni79929 2020-06-03 15:26:07 +02:00
commit 59bed06f72
4 changed files with 109 additions and 6 deletions

47
.dockerignore Normal file
View File

@ -0,0 +1,47 @@
# Git related files
.git
# compiled output
dist
tmp
out-tsc
# Only exists if Bazel was run
bazel-out
# dependencies
node_modules
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# IDEs and editors
.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
.sass-cache
connect.lock
coverage
libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
typings
# System Files
.DS_Store
Thumbs.db

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# Stage 1: Build
FROM node:alpine AS build
WORKDIR /build
## Install app dependencies
COPY package*.json ./
RUN npm install
## Bundle app source
COPY . .
## Compile App
RUN npm run build
# Stage 2: Package up with the webserver
FROM nginx:alpine AS final
COPY --from=build /build/dist/frontend /usr/share/nginx/html

View File

@ -2,26 +2,54 @@
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.7. This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.7.
## Development server ## Angular CLI
### Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding ### Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build ### Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests ### Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests ### Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
## Further help ### Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
## Deploy with Docker
> Prerequisite: Docker and/or Docker Compose have to be installed on your system </br>
> The Docker installation instructions for most operation systems can be found here: [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/) </br>
> The Docker Compose installation instructions for most operation systems can be found here: [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
### Quick Deployment with Docker Compose
1. Clone the git repo
2. Open the cloned repo's folder in a shell of your choice (as long as it supports Docker)
3. Tell Docker Compose to build - if it hasn't already been built - and run the app with `docker-compose up`
Other useful commands:
* Just build: `docker-compose build`
* Build before running: `docker-compose up --build`
* Run attached (in the background): `docker-compose up -d`
* Stop: `docker-compose down`
* Restart: `docker-compose restart`
### Build the Container yourself (and run it)
1. Clone the git repo
2. Open the cloned repo's folder in a shell of your choice (as long as it supports Docker)
3. Tell Docker to build the app under the name "frontend" with `docker build -t taskboard_frontend .`
4. Tell Docker to run the app on port 8080 with `docker run -p 8080:80 taskboard_frontend`
Other useful commands:
* Run detached: `docker run -d -p 8080:80 taskboard_frontend`
* Run under specified name: `docker run -p 8080:80 --name frontend taskboard_frontend`

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: "3"
services:
app:
build:
context: .
restart: unless-stopped
networks:
- default
ports:
- "8080:80"