How to minify Strapi project for production

I am working on deployment of my strapi app on AWS.
My plan of action is to package the app into a docker image and run it with docker-compose on a cluster of EC2 instances behind the AWS ALB.

The concern I have is about the size of the docker image that strapi project produces.
I build my docker image off the base ubuntu:18.04 which is only 73Mb but the final strapi image is 1.4Gb

REPOSITORY TAG IMAGE ID CREATED SIZE
strapi-server latest 055d3b7fca5a 9 hours ago 1.39GB
ubuntu latest 26b77e58432b 5 days ago 72.9MB

Has anyone successfully managed to compress/minify a strapi project (for production)?
I do not anticipate creating new types (i.e. modifying schema) in production but only creating entries for existing schemas.
Also, if I want to have a cluster of machines that serve just like API servers (no Admin UI needed) and have a dedicated machine for Admin IU, how do I go about cutting the Admin UI part with all its deps from those API-server builds?

I am keen to hear thoughts from those who have tried something and especially keen to hear from Strapi team.

1 Like

Currently it’s not possible as the backend can’t be “built” as it runs as a service so the node_modules are required which make up the bulk of that size.

@DMehaffy thanks for the reply!

What about removing Admin UI with all its glory?
I don’t want the dashboard UI to show up if someone hits my API server endpoint with GET /dahsboard request. Not to mention this will reduce the size of the package a tiny little bit.
I could set my ALB to block path if it includes /dashboard but this is more of a hack while disabling this on the strapi side sounds more like a proper approach.

1 Like

My guy that can’t work the best thing is to put your whole project in a git hub directory and then use Heroku or any software like that to host the backend