Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/build docker #105

Merged
merged 28 commits into from
Dec 5, 2023
Merged

Feat/build docker #105

merged 28 commits into from
Dec 5, 2023

Conversation

iaurg
Copy link
Owner

@iaurg iaurg commented Nov 18, 2023

Description

Everything has to be launched by a single call to docker-compose up --build

Related Issue

#57

Copy link

vercel bot commented Nov 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
42-transcendence ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2023 2:47am

iaurg and others added 5 commits November 22, 2023 23:23
* feat: add pino logger and update prisma to fix bug

* feat: add global logger

* feat: instantiate logger into chat

* refactor: remove dev container

* feat: move post create command

* refactor: simplify docker files

* feat: create a temporary db for dev

* refactor: move declarations

* refactor: logger configs

* feat: add status into user connection

* fix: default user status creation to offline

* feat: add status requests

* feat: return status and display name on leaderboard

* feat: update status component to use status from server

* feat: update user type and revalidate query

* Feat/83-image-upload (#86)

* feat: create avatar upload route

* wip: opening map to uploads folder

* feat: update avatar reference into user

* feat: create avatar upload route

* chore: add new todo

* feat: expose dir to be public

* feat: add new packages

* fix: duplicated avatar module

* fix: token flow over websocket

* refactor: remove not used query

* feat: add option to upload avatar in frontend

* feat: rebase conflicts

* refactor: remove files

* Feat/user friends (#92)

* feat: start user friends feature

* chore: add uploads folder into gitignore

* feat: create simple friend request functional

* feat: add option to add,remove and list friends on front

* feat: add global logger

* feat: create a temporary db for dev

* feat: add statuses into list friend

* Feat/83-image-upload (#86)

* feat: create avatar upload route

* wip: opening map to uploads folder

* feat: update avatar reference into user

* feat: create avatar upload route

* chore: add new todo

* feat: expose dir to be public

* feat: add new packages

* fix: duplicated avatar module

* fix: token flow over websocket

* refactor: remove not used query

* feat: add option to upload avatar in frontend

* feat: rebase conflicts

* refactor: remove files

* feat: add pino logger and update prisma to fix bug

* Feat/83-image-upload (#86)

* feat: create avatar upload route

* wip: opening map to uploads folder

* feat: update avatar reference into user

* feat: create avatar upload route

* chore: add new todo

* feat: expose dir to be public

* feat: add new packages

* fix: duplicated avatar module

* fix: token flow over websocket

* refactor: remove not used query

* feat: add option to upload avatar in frontend

* feat: rebase conflicts

* refactor: remove files

* feat: add global logger

* fix: rollback argon2

* feat: add data into ignore

* fix: build error

* fix: duplicated value after merge

* fix: duplicated import
* fix: hardcoded localhost game socket

* fix: localhost hardcoded chat
* wip: add chat actions

* wip: add guards back to project

- add mock chats to seed database
- reenable auth guard
- add hooks to chat popover modal

* fix: update components

* fix: add owner to seeded chats

* fix: update seed to render chat owner

* fix: add warning to change user

* fix: add onloading state to component

* fix: drop exception handler

- avoid server backend shutdown

* feat: implement demote to member

* fix: lint files
* fix: remove bugs

- remove bug for chat gateway
- fix bug where user was able to find promote to admin button

* fix: remove a few more bugs from chat

- add mute block handler when trying to send messages when the user is muted
- simplify channelpopover handler logic

---------

Co-authored-by: Italo A <[email protected]>
Juliano added 3 commits December 2, 2023 18:18
- Bumps node version to 20 (LTS)
- Separates into multi-stage dev/build/prod
- Updates prisma to work in latest alpine
- Bumps backend package versions
## Backend
- Updates backend database migration
- Replaces backend wildcard CORS to FRONTEND_URL
- Updates backend Dockerfile to use an entrypoint script
## Frontend
- Reverts API to `with_credentials`for proper cookie handling
- Bumps package versions
- Moves types/lint packages to devDependencies
- Adds multi-stage Dockerfile to production recommendations
## Docker Compose
- Replaces restart policy to `unless-stopped`
- Adds named volumes
- Removes frontend volumes
- Fixes frontend internal port to match external port
@julianochoi
Copy link
Collaborator

In my setup, building the docker images with docker compose build --no-cache, with the postgres and node images previously pulled, the entire build took 57.2 seconds.
Both frontend and backend are built simultaneously and the largest bottlenecks are the package installations and build (as expected).

Backend

npm ci: 16.3s
npm run build: 5.4s

Frontend

npm ci: 10s
npm run build: 37.7s

Even though the frontend build is taking a little bit of time, I think it is fine for now.

- Adds database url in the entrypoint to simplify prisma setup
Copy link
Collaborator

@vcwild vcwild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@vcwild vcwild merged commit e3a2298 into main Dec 5, 2023
4 checks passed
@vcwild vcwild deleted the feat/build-docker branch December 5, 2023 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Criar docker-compose up --build comando para iniciar todo o projeto
4 participants