Make it work with Docker Compose and remove Firebase API from code
This commit is contained in:
parent
c3f94cca45
commit
59eba56153
9 changed files with 17551 additions and 70 deletions
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
services:
|
||||||
|
frontend:
|
||||||
|
build: frontend
|
||||||
|
ports:
|
||||||
|
- "80:4200"
|
||||||
|
volumes:
|
||||||
|
- ./frontend:/home/node/app
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
name: szakdolgozat
|
||||||
|
driver: bridge
|
9
frontend/Dockerfile
Normal file
9
frontend/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
FROM node:16
|
||||||
|
|
||||||
|
EXPOSE 4200
|
||||||
|
|
||||||
|
COPY docker.sh /docker.sh
|
||||||
|
RUN chmod +x docker.sh
|
||||||
|
WORKDIR /home/node/app
|
||||||
|
|
||||||
|
ENTRYPOINT /docker.sh
|
4
frontend/docker.sh
Normal file
4
frontend/docker.sh
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
echo "Installing packages"
|
||||||
|
npm install
|
||||||
|
echo "Running application"
|
||||||
|
npm start
|
17558
frontend/package-lock.json
generated
17558
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -3,7 +3,7 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve --host 0.0.0.0 --disable-host-check",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {BreakpointObserver, Breakpoints} from '@angular/cdk/layout';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {map, shareReplay} from 'rxjs/operators';
|
import {map, shareReplay} from 'rxjs/operators';
|
||||||
import {LoginService} from './shared/login.service';
|
import {LoginService} from './shared/login.service';
|
||||||
import firebase from 'firebase';
|
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ErrorStateMatcher} from '@angular/material/core';
|
import {ErrorStateMatcher} from '@angular/material/core';
|
||||||
import {AbstractControl, FormControl, FormGroupDirective, NgForm, ValidationErrors, Validators} from '@angular/forms';
|
import {AbstractControl, FormControl, FormGroupDirective, NgForm, ValidationErrors, Validators} from '@angular/forms';
|
||||||
import firebase from 'firebase';
|
|
||||||
import {LoginService} from '../shared/login.service';
|
import {LoginService} from '../shared/login.service';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,21 @@
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import firebase from 'firebase';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class LoginService {
|
export class LoginService {
|
||||||
|
|
||||||
loggedInUser: firebase.User;
|
loggedInUser: string; // TODO
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
firebase.initializeApp((window as any).firebaseCredentials);
|
|
||||||
firebase.auth().onAuthStateChanged(user => {
|
|
||||||
this.loggedInUser = user;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async createUser(email: string, pass: string): Promise<void> {
|
async createUser(email: string, pass: string): Promise<void> {
|
||||||
const user = await firebase.auth().createUserWithEmailAndPassword(email, pass);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async logout(): Promise<void> {
|
async logout(): Promise<void> {
|
||||||
await firebase.auth().signOut();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async login(email: string, pass: string): Promise<void> {
|
async login(email: string, pass: string): Promise<void> {
|
||||||
await firebase.auth().signInWithEmailAndPassword(email, pass);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,27 +11,5 @@
|
||||||
</head>
|
</head>
|
||||||
<body class="mat-typography">
|
<body class="mat-typography">
|
||||||
<app-root></app-root>
|
<app-root></app-root>
|
||||||
<!-- Insert these scripts at the bottom of the HTML, but before you use any Firebase services -->
|
|
||||||
<!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->
|
|
||||||
<!-- <script src="/__/firebase/8.1.2/firebase-app.js"></script> -->
|
|
||||||
|
|
||||||
<!-- Add Firebase products that you want to use -->
|
|
||||||
<!-- <script src="/__/firebase/8.1.2/firebase-auth.js"></script>
|
|
||||||
<script src="/__/firebase/8.1.2/firebase-firestore.js"></script> -->
|
|
||||||
|
|
||||||
<!-- Initialize Firebase -->
|
|
||||||
<!-- <script src="/__/firebase/init.js"></script> -->
|
|
||||||
|
|
||||||
<script>
|
|
||||||
window.firebase = {
|
|
||||||
initializeApp: function (credentials) {
|
|
||||||
window.firebaseCredentials = credentials
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script src="/__/firebase/init.js"></script>
|
|
||||||
<script>
|
|
||||||
window.firebase = undefined;
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue