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

chore: unified dockerfile #1840

Merged
merged 35 commits into from Mar 20, 2024
Merged

chore: unified dockerfile #1840

merged 35 commits into from Mar 20, 2024

Conversation

bodinsamuel
Copy link
Contributor

@bodinsamuel bodinsamuel commented Mar 12, 2024

Note

This is a proposal, open to debate.

Context

Fixes NAN-596

We currently maintain 4 Dockerfiles, and need to build 7 in total. I feel like it's a lot to maintain. As we grow we will add more images and more folder in packages which can results in more stuff being build for nothing and errors.

I would love to reduce this maintenance to 3 images (staging, prod, enterprise) and down to 1 if possible. Right now we need many versions also because we pass dedicated env vars to the Webapp build which is something we could do differently (e.g: serving those via API calls)

Proposal

  • Build one unified Docker image nangohq/nango

It's currently 148MB (compressed) hub.docker.com vs nangohq/nango is 145MB. So the difference is already minimal enough that it doesn't really matter.

NB: the image is private rn

NB: I disabled build for entreprise for the moment. I feel like it would be a waste of time and if we manage to get rid of the Env Vars situation, the single image could serve this scenario.

Migration

If we agree the migration path is not urgent. We just need to take the time to do it when we want.
E.g for jobs:

  • changing the image to nangohq/jobs:production to nangohq/nango:prod-<hash>
  • adding a Docker Command, e.g: node packages/jobs/dist/app.js
  • When we deploy, instead of triggering a new deploy on the same tag, we can trigger a deploy with the new image url

NB: this should also solve our docker caching issue

Should we keep the other images?

In the long-term I feel like it's not really useful, I think what other projects are doing is perfect with only 2-3 images:

  • project/image_community
  • project/image_entreprise
  • project/image_private (for us)

@bodinsamuel bodinsamuel self-assigned this Mar 12, 2024
Copy link

linear bot commented Mar 19, 2024

@bodinsamuel bodinsamuel marked this pull request as ready for review March 19, 2024 10:44
@bodinsamuel bodinsamuel changed the title unified dockerfile chore: unified dockerfile Mar 19, 2024
@bodinsamuel
Copy link
Contributor Author

Talked with @bastienbeurier we agreed on this solution, as long as we communicate and document the change.
We will keep building all others images until the migration is done on our side then deprecate their usage officially.

@bodinsamuel
Copy link
Contributor Author

Can I have a review on this @khaliqgant @TBonnin? thanks ☺️

Dockerfile Outdated Show resolved Hide resolved
@khaliqgant khaliqgant self-requested a review March 20, 2024 10:09
@khaliqgant
Copy link
Member

Thanks Samuel. I think this makes sense, but the work here should be captured in a project within our ticketing system. I say that to make sure we encompass the impacted pieces of this change as a checklist of sorts.

@bodinsamuel
Copy link
Contributor Author

Good point I created a Linear project https://linear.app/nango/project/unified-dockerfile-1a4273be8741

Dockerfile Outdated Show resolved Hide resolved
ENV IMAGE_ENV $image_env
ENV GIT_HASH $git_hash

EXPOSE 8080
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we currently use port 80. That would require an infra change if yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

locally we use 300x
on render we pass port in an env var, e.g:NANGO_JOBS_PORT
I don't think it will be much more complicated than changing the env var but my test on staging will tell us

scripts/build_docker.sh Show resolved Hide resolved
@bodinsamuel bodinsamuel merged commit 2ef8f40 into master Mar 20, 2024
18 checks passed
@bodinsamuel bodinsamuel deleted the feat/unified-dockerfile branch March 20, 2024 14:47
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.

None yet

3 participants