Skip to content

Fix strip choking on non-binary files; bump Alpine to 3.23 and implement multi-stage build#3029

Open
biliwala wants to merge 3 commits into
shadowsocks:masterfrom
biliwala:dockerfile-patch
Open

Fix strip choking on non-binary files; bump Alpine to 3.23 and implement multi-stage build#3029
biliwala wants to merge 3 commits into
shadowsocks:masterfrom
biliwala:dockerfile-patch

Conversation

@biliwala

@biliwala biliwala commented Mar 2, 2026

Copy link
Copy Markdown

Issue:
The Alpine Docker build fails with a strip: ss-setup: file format not recognized error. This occurs because the strip command targets all files in /usr/local/bin, including non-binary scripts such as ss-nat and ss-setup.

Solution:
The build logic has been updated to use scanelf to identify and target only ELF binaries for stripping. This replaces the manual file exclusion method (grep -v) with an automated format check.


Improvements:

  • Bump base image Alpine to 3.23
  • Implement multi-stage build to reduce image size

- fix strip error
@madeye

madeye commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Thanks — the scanelf -E ET_DYN -E ET_EXEC approach is the more robust fix for strip choking on the shell scripts (ss-nat/ss-setup). Note this overlaps with #3031, which edits the same strip line (and also bumps Alpine 3.16→3.19). I'd like to land both behaviors together; could you rebase so the scanelf strip and the Alpine bump don't conflict? Keeping open pending a Docker image build check.

@madeye madeye mentioned this pull request Jun 17, 2026
@biliwala biliwala changed the title fix: stop strip from choking on non-binary files in Docker build Fix strip choking on non-binary files; bump Alpine to 3.24 and implement multi-stage build Jun 18, 2026
@biliwala biliwala changed the title Fix strip choking on non-binary files; bump Alpine to 3.24 and implement multi-stage build Fix strip choking on non-binary files; bump Alpine to 3.23 and implement multi-stage build Jun 18, 2026
@biliwala

biliwala commented Jun 18, 2026

Copy link
Copy Markdown
Author

Rebased on vndroid/master.
By the way, I also added a multi-stage build here. It reduces the disk usage from 28.2MB to 22.8MB (content size from 7.29MB to 6.24MB).
Let me know if you want me to keep it here or split the multi-stage build into a separate PR later.
Ready for the build check.

biliwala added 2 commits June 18, 2026 16:05
The build logic has been updated to use `scanelf` to identify and target only ELF binaries for stripping, avoiding build failures caused by the `strip` command targeting non-binary scripts like `ss-nat` and `ss-setup`.
…age build

- Bump base image from Alpine 3.19 to 3.23
- Implement multi-stage build to reduce image size
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.

3 participants