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

Putting the dashboard on a diet #25

Merged
merged 4 commits into from
Jan 22, 2024
Merged

Putting the dashboard on a diet #25

merged 4 commits into from
Jan 22, 2024

Conversation

rynowak
Copy link
Contributor

@rynowak rynowak commented Jan 22, 2024

Summary

This change removes unused features of the Dashboard to reduce its overall size. I'm using the results of this run as the baseline for size comparisons.

Our total size right now is: 958.537 MB

For comparison, our control-plane services are in the range of ~40-80 MB each.

Of that ~450 MB comes from the base image and dependencies. In particular yarn install is adding ~405 MB of JS/static/native dependencies to the application.

The features I'm targeting for trimming are the ones we don't actually use in the Dashboard:

  • Catalog/Entity display (includes Techdocs)
  • Scaffolding
  • Search

Once we remove Scaffolding we can also remove Python from the base image.

Baseline

 IMAGE          CREATED              CREATED BY                                      SIZE      COMMENT
bc82f115b919   30 seconds ago       CMD ["node" "packages/backend" "--config" "a…   0B        buildkit.dockerfile.v0
<missing>      30 seconds ago       RUN /bin/sh -c tar xzf bundle.tar.gz && rm b…   46.6MB    buildkit.dockerfile.v0
<missing>      31 seconds ago       COPY packages/backend/dist/bundle.tar.gz app…   11.8MB    buildkit.dockerfile.v0
<missing>      31 seconds ago       RUN /bin/sh -c YARN_CACHE_FOLDER=/home/node/…   405MB     buildkit.dockerfile.v0
<missing>      About a minute ago   RUN /bin/sh -c tar xzf skeleton.tar.gz && rm…   4.12kB    buildkit.dockerfile.v0
<missing>      About a minute ago   COPY .yarnrc.yml yarn.lock package.json pack…   1.25MB    buildkit.dockerfile.v0
<missing>      About a minute ago   ENV NODE_ENV=production                         0B        buildkit.dockerfile.v0
<missing>      About a minute ago   WORKDIR /app                                    0B        buildkit.dockerfile.v0
<missing>      About a minute ago   USER node                                       0B        buildkit.dockerfile.v0
<missing>      About a minute ago   RUN /bin/sh -c apt-get update &&     apt-get…   3.45MB    buildkit.dockerfile.v0
<missing>      About a minute ago   RUN /bin/sh -c apt-get update &&     apt-get…   333MB     buildkit.dockerfile.v0
<missing>      About a minute ago   RUN /bin/sh -c corepack enable && yarn -v # …   7.53MB    buildkit.dockerfile.v0
<missing>      5 days ago           /bin/sh -c #(nop)  CMD ["node"]                 0B        
<missing>      5 days ago           /bin/sh -c #(nop)  ENTRYPOINT ["docker-entry…   0B        
<missing>      5 days ago           /bin/sh -c #(nop) COPY file:4d192565a7220e13…   388B      
<missing>      5 days ago           /bin/sh -c set -ex   && savedAptMark="$(apt-…   9.36MB    
<missing>      5 days ago           /bin/sh -c #(nop)  ENV YARN_VERSION=1.22.19     0B        
<missing>      5 days ago           /bin/sh -c ARCH= OPENSSL_ARCH= && dpkgArch="…   112MB     
<missing>      5 days ago           /bin/sh -c #(nop)  ENV NODE_VERSION=18.19.0     0B        
<missing>      5 days ago           /bin/sh -c groupadd --gid 1000 node   && use…   8.9kB     
<missing>      5 days ago           /bin/sh -c #(nop)  CMD ["bash"]                 0B        
<missing>      5 days ago           /bin/sh -c #(nop) ADD file:9deb26e1dbc258df4…   74.8MB    

@rynowak
Copy link
Contributor Author

rynowak commented Jan 22, 2024

First iteration down to 898.699 MB.

Reduced JS/static/native dependencies 405 MB -> 348 MB

packages/backend/Dockerfile Show resolved Hide resolved
@rynowak
Copy link
Contributor Author

rynowak commented Jan 22, 2024

Removing Python from the image gets us down to 559.004 MB.

@rynowak
Copy link
Contributor Author

rynowak commented Jan 22, 2024

To get much further than this, we'll need a multi-stage build and possibly bundling for the backend to slim down node_modules/.

When we list the dependencies in node_modules/ it's clear that most of them are frontend dependencies, not backend dependencies.

I'm going to hold off on the next change until we can get some better E2E tests in place for the container. It would be miserable if we break things without knowing.

Here's a list of the top package dependencies by size:

image

@rynowak rynowak changed the title [WIP] Putting the dashboard on a diet Putting the dashboard on a diet Jan 22, 2024
@rynowak rynowak merged commit 253cbc2 into radius-project:main Jan 22, 2024
3 checks passed
@rynowak rynowak deleted the diet branch January 22, 2024 18:23
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.

2 participants