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

Get UPX working on x86 to decrease Docker image size for API #955

Open
joswayski opened this issue Mar 3, 2024 · 0 comments
Open

Get UPX working on x86 to decrease Docker image size for API #955

joswayski opened this issue Mar 3, 2024 · 0 comments
Labels
🗃️ backlog Stuff I would like to get to eventually, but not prioritized at the moment. ☁️ infrastructure / cloud / hosting / k3s Related to anything infrasructure / kubernetes

Comments

@joswayski
Copy link
Member

joswayski commented Mar 3, 2024

Until Hetzner has ARM in the US, we have to build for AMD/x86. However this produces a MASSIVE YUGE dockerfile
CleanShot 2024-03-02 at 19 44 02@2x

;)

This is to see if we can reduce it, but right now we get an error when adding it in the packages/api (and consumer when added)
CleanShot 2024-03-02 at 19 46 42@2x

Acceptance Criteria:
Size is reduced from these figures for x86 builds

 => [builder 5/6] RUN cargo build --release --target x86_64-unknown-linux-gnu                                                      771.7s
 => ERROR [builder 6/6] RUN upx --best --lzma /app/target/x86_64-unknown-linux-gnu/release/api                                       0.2s
------                                                                                                                                    
 > [builder 6/6] RUN upx --best --lzma /app/target/x86_64-unknown-linux-gnu/release/api:                                                  
#0 0.166                        Ultimate Packer for eXecutables                                                                           
#0 0.166                           Copyright (C) 1996 - 2020                                                                              
#0 0.166 UPX 3.96        Markus Oberhumer, Laszlo Molnar & John Reiser   Jan 23rd 2020                                                    
#0 0.166 
#0 0.166         File size         Ratio      Format      Name
#0 0.166    --------------------   ------   -----------   -----------
#0 0.166 upx: /app/target/x86_64-unknown-linux-gnu/release/api: CantPackException: bad DT_GNU_HASH n_bucket=0x4c  n_bitmask=0x4  len=0x208
#0 0.167 
#0 0.167 Packed 0 files.
------
Dockerfile:96
--------------------
  94 |     # # Compress the executable using UPX
  95 |     # If you enable UPX compression, ensure your binary is compatible or omit this step
  96 | >>> RUN upx --best --lzma /app/target/x86_64-unknown-linux-gnu/release/api
  97 |     
  98 |     # Final stage uses distroless for minimal size
--------------------
ERROR: failed to solve: process "/bin/sh -c upx --best --lzma /app/target/x86_64-unknown-linux-gnu/release/api" did not complete successfully: exit code: 1
@joswayski joswayski added 🗃️ backlog Stuff I would like to get to eventually, but not prioritized at the moment. ☁️ infrastructure / cloud / hosting / k3s Related to anything infrasructure / kubernetes labels May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗃️ backlog Stuff I would like to get to eventually, but not prioritized at the moment. ☁️ infrastructure / cloud / hosting / k3s Related to anything infrasructure / kubernetes
Projects
None yet
Development

No branches or pull requests

1 participant