Skip to content

Commit

Permalink
Fixed the issue with docker frontend deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonpoltorak committed May 23, 2023
1 parent 1913062 commit 083ecb1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Makefile scripts may need administrator priviliges due to *docker* command usage

* `make`, `make all`, `make build` - uses *docker-compose* to build the whole project.
Frontend of the app will be available at `localhost:4200`,
database at `localhost:5000` and backend at `localhost:8080`
database at `localhost:5432` and backend at `localhost:8080`

* `make clean` - command used to remove with force images created ,
during *docker-compose* build
Expand Down
2 changes: 2 additions & 0 deletions social-app-frontend/Dockerfile.frontend
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ RUN npm run ng build --configuration=docker

FROM nginx:alpine

COPY nginx.conf /etc/nginx/conf.d/default.conf

COPY --from=node /app/dist/social-app-frontend /usr/share/nginx/html

EXPOSE 80
9 changes: 9 additions & 0 deletions social-app-frontend/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
}
6 changes: 3 additions & 3 deletions social-app-frontend/src/app/core/guards/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export class AuthGuard implements CanActivate {
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {

// if (!this.userService.isUserAuthenticated) {
// return this.router.createUrlTree([RoutePaths.LOGIN_DIRECT]);
// }
if (!this.userService.isUserAuthenticated) {
return this.router.createUrlTree([RoutePaths.LOGIN_DIRECT]);
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ export class UserService {
private isAuthenticated !: boolean;
private wasLoggedOut !: boolean;

constructor() {
}

/**
* Gets the flag indicating whether the user is authenticated.
*/
Expand Down

0 comments on commit 083ecb1

Please sign in to comment.