weird icon indicating copy to clipboard operation
weird copied to clipboard

Fix Weird Frontend Container Image Size

Open zicklag opened this issue 1 year ago • 3 comments

I just reallized that the Weird container image is 1.1GB which does not sound right at all. We need to investigate.

zicklag avatar Aug 04 '24 16:08 zicklag

I am the author of this article https://blog.logrocket.com/optimizing-ci-cd-pipelines-rust-projects/#optimizing-docker-image-build, I will try to investigate.

azzamsa avatar Aug 10 '24 07:08 azzamsa

Our current steps result in a whopping 1 GB image.

docker build . -t weird:latest
✦ 🙊 docker images
REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
weird        latest    2392a8f6fab2   26 seconds ago   1.1GB

Turns out nothing wrong with our current steps. As shown here:

weird@5b09c4e3d68a:/$ du -sh project/
3.7M    project/

Changing the base image solves the issue right away

REPOSITORY               TAG             IMAGE ID       CREATED             SIZE
weird                    latest-slim     6f135e90c544   25 minutes ago      204MB
weird                    latest-alpine   50d0765b3cf7   53 minutes ago      138MB
weird                    latest          2392a8f6fab2   About an hour ago   1.1GB

alpine is the smallest, but unless we have exhaustive testing, I hesitate to use it, as sometimes there is an error related to musl only. But we can try on staging for a while and see if there are any errors with the Alpine image. Otherwise, we just use the debian-slim.


Step to reproduce:

$ docker build . -t weird:latest
$ docker build . -t weird:latest-alpine
$ docker build . -t weird:latest-slim
services:
  weird:
    image: weird:latest
    env_file: .env.local
    ports:
      - '9523:3000'

Related tags https://hub.docker.com/_/node

@zicklag what do you think? Should we give Alpine a try or just go with Debian-slim?

azzamsa avatar Aug 21 '24 06:08 azzamsa

I can't test extensively because I get this error. Error registering user: Error computing proof of work, you may need a browser update. Tried to change to other web browsers but no luck.

image

azzamsa avatar Aug 21 '24 06:08 azzamsa

This was fixed in some commit around: 29e1cf124e13bdfb426851f37e17cd86c4cd9ff5

zicklag avatar Sep 05 '24 16:09 zicklag