Skip to content

Commit 55b6d83

Browse files
committed
Dockerized the app
1 parent 1dca66e commit 55b6d83

File tree

20 files changed

+158
-45
lines changed

20 files changed

+158
-45
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
npm-debug.log
3+
yarn-error.log
4+
5+
# Angular
6+
dist/
7+
e2e/
8+
.angular/

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ yarn-error.log
88
# Angular
99
dist/
1010
e2e/
11-
.angular/
11+
.angular/
12+
13+
server/public/*

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:20
2+
3+
# Copy the frontend/ folder and the server/ folder
4+
COPY frontend/package*.json ./frontend/
5+
RUN cd frontend && npm install --silent
6+
7+
COPY server/package*.json ./server/
8+
RUN cd server && npm install --silent
9+
10+
# Copy the rest of the files
11+
COPY frontend ./frontend
12+
COPY server ./server
13+
14+
# Build the frontend and the server
15+
RUN cd frontend && npm run build
16+
RUN cd server && npm run build
17+
18+
EXPOSE 3000
19+
20+
CMD ["node", "server/dist/server.js"]

TODO.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# TODO
22

3-
- [ ] - Create nothere Page
4-
- [ ] - localstorage the login
5-
- [ ] - Dockerize the whole app
63
- [ ] - Deploy the app to homeserver
74
- [ ] - Clean up the code

docker-compose.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
1-
version: '3.8'
1+
version: "3.8"
22

33
services:
4-
db:
4+
server-db-planaslot:
55
image: postgres:15
6-
container_name: postgres_db
6+
container_name: server-db-planaslot
77
environment:
8-
POSTGRES_USER: ${POSTGRES_USER}
9-
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
8+
POSTGRES_USER: ${DB_USER}
9+
POSTGRES_PASSWORD: ${DB_PASSWORD}
1010
POSTGRES_DB: planaslot
1111
ports:
12-
- "5432:5432"
12+
- "${DB_PORT}:5432"
1313
volumes:
1414
- pgdata:/var/lib/postgresql/data
15+
- ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql
1516
restart: always
1617

18+
server-planaslot:
19+
build: .
20+
container_name: server-planaslot
21+
env_file:
22+
- .env
23+
ports:
24+
- "8001:3000"
25+
restart: unless-stopped
26+
depends_on:
27+
- server-db-planaslot
28+
1729
volumes:
1830
pgdata:

frontend/angular.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
"build": {
1818
"builder": "@angular-devkit/build-angular:application",
1919
"options": {
20-
"outputPath": "dist/frontend",
20+
"outputPath": {
21+
"base": "../server/public",
22+
"browser": ""
23+
},
2124
"index": "src/index.html",
2225
"browser": "src/main.ts",
2326
"polyfills": ["zone.js"],
@@ -42,13 +45,13 @@
4245
"budgets": [
4346
{
4447
"type": "initial",
45-
"maximumWarning": "500kB",
46-
"maximumError": "1MB"
48+
"maximumWarning": "2MB",
49+
"maximumError": "2MB"
4750
},
4851
{
4952
"type": "anyComponentStyle",
50-
"maximumWarning": "2kB",
51-
"maximumError": "4kB"
53+
"maximumWarning": "2MB",
54+
"maximumError": "2MB"
5255
}
5356
],
5457
"outputHashing": "all"

frontend/src/app/env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export const URL = "http://localhost:4200";
2-
export const API_URL = "http://localhost:3000/api/v1";
1+
export const URL = "https://planaslot.homeserver-ericp.fr";
2+
export const API_URL = "http://localhost:8001/api/v1";

frontend/src/app/imports.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { CalendarModule } from "primeng/calendar";
77
import { CheckboxModule } from "primeng/checkbox";
88
import { ConfirmDialogModule } from "primeng/confirmdialog";
99
import { FloatLabelModule } from "primeng/floatlabel";
10+
import { InputGroupModule } from "primeng/inputgroup";
11+
import { InputGroupAddonModule } from "primeng/inputgroupaddon";
1012
import { InputTextModule } from "primeng/inputtext";
1113
import { MenubarModule } from "primeng/menubar";
1214
import { TableModule } from "primeng/table";
@@ -29,6 +31,8 @@ import { ToastModule } from "primeng/toast";
2931
ConfirmDialogModule,
3032
ToastModule,
3133
ButtonModule,
34+
InputGroupModule,
35+
InputGroupAddonModule,
3236
],
3337
exports: [
3438
CommonModule,
@@ -44,6 +48,8 @@ import { ToastModule } from "primeng/toast";
4448
ConfirmDialogModule,
4549
ToastModule,
4650
ButtonModule,
51+
InputGroupModule,
52+
InputGroupAddonModule,
4753
],
4854
providers: [Router],
4955
})

frontend/src/app/pages/admin/admin.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class AdminComponent implements OnInit {
1818

1919
endDate: Date = new Date();
2020

21-
isLogged: boolean = true;
21+
isLogged: boolean = false;
2222

2323
constructor(
2424
private loginService: LoginService,

frontend/src/app/pages/create-event/create-event.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ export class CreateEventComponent {
113113
summary: "Erreur",
114114
detail: `Erreur lors de la création de l'événement`,
115115
});
116-
117-
console.error(err);
118116
});
119117
}
120118
}

0 commit comments

Comments
 (0)