Make it work with Docker Compose and remove Firebase API from code

This commit is contained in:
Norbi Peti 2021-11-08 23:53:39 +01:00
parent c3f94cca45
commit 59eba56153
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
9 changed files with 17551 additions and 70 deletions

14
docker-compose.yml Normal file
View 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
View 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
View file

@ -0,0 +1,4 @@
echo "Installing packages"
npm install
echo "Running application"
npm start

17558
frontend/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start": "ng serve --host 0.0.0.0 --disable-host-check",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",

View file

@ -3,7 +3,6 @@ import {BreakpointObserver, Breakpoints} from '@angular/cdk/layout';
import {Observable} from 'rxjs';
import {map, shareReplay} from 'rxjs/operators';
import {LoginService} from './shared/login.service';
import firebase from 'firebase';
import {Router} from '@angular/router';
@Component({

View file

@ -1,7 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {ErrorStateMatcher} from '@angular/material/core';
import {AbstractControl, FormControl, FormGroupDirective, NgForm, ValidationErrors, Validators} from '@angular/forms';
import firebase from 'firebase';
import {LoginService} from '../shared/login.service';
import {Router} from '@angular/router';

View file

@ -1,29 +1,21 @@
import {Injectable} from '@angular/core';
import firebase from 'firebase';
@Injectable({
providedIn: 'root'
})
export class LoginService {
loggedInUser: firebase.User;
loggedInUser: string; // TODO
constructor() {
firebase.initializeApp((window as any).firebaseCredentials);
firebase.auth().onAuthStateChanged(user => {
this.loggedInUser = user;
});
}
async createUser(email: string, pass: string): Promise<void> {
const user = await firebase.auth().createUserWithEmailAndPassword(email, pass);
}
async logout(): Promise<void> {
await firebase.auth().signOut();
}
async login(email: string, pass: string): Promise<void> {
await firebase.auth().signInWithEmailAndPassword(email, pass);
}
}

View file

@ -11,27 +11,5 @@
</head>
<body class="mat-typography">
<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>
</html>