-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add musl build based on alpine linux image #116
Open
Logikgate
wants to merge
1
commit into
node-gfx:master
Choose a base branch
from
flypapertech:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
VER=$1 | ||
source ~/.nvm/nvm.sh | ||
source ~/.profile | ||
nvm use $VER || { nvm install $VER; nvm use $VER; } | ||
npm install -g node-gyp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM alpine:3.11 | ||
RUN apk update && apk add --no-cache \ | ||
build-base \ | ||
g++ \ | ||
cairo-dev \ | ||
jpeg-dev \ | ||
pango-dev \ | ||
giflib-dev \ | ||
curl \ | ||
bash \ | ||
coreutils \ | ||
libstdc++ \ | ||
git \ | ||
librsvg-dev \ | ||
lddtree \ | ||
pax-utils \ | ||
zlib-dev \ | ||
libffi-dev \ | ||
libpng-dev \ | ||
libjpeg-turbo-dev \ | ||
fribidi-dev \ | ||
pcre-dev \ | ||
glib-dev \ | ||
freetype-dev \ | ||
harfbuzz-dev \ | ||
expat-dev \ | ||
fontconfig-dev \ | ||
pixman-dev \ | ||
python2 \ | ||
gdk-pixbuf-dev \ | ||
libxml2-dev \ | ||
libcroco-dev | ||
|
||
RUN bash -c 'touch ~/.profile' | ||
|
||
# https://stackoverflow.com/questions/52196518/could-not-get-uid-gid-when-building-node-docker | ||
ENV npm_config_unsafe_perm=true | ||
# Suppress g++ casting warnings that come from node, nan and v8 (https://github.com/nodejs/nan/issues/807) | ||
ENV CXXFLAGS="-Wno-cast-function-type" | ||
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash | ||
|
||
# Get nvm to work with alpine https://github.com/nvm-sh/nvm/issues/1102#issuecomment-550572252 | ||
RUN bash -c 'echo "NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release" >> ~/.profile' | ||
RUN bash -c 'echo "nvm_get_arch() { nvm_echo \"x64-musl\"; }" >> ~/.profile' | ||
|
||
RUN bash -c 'source ~/.profile; cd; nvm install v12' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that Alpine 3.11 uses musl libc 1.1.24, released in October. Assuming musl adds symbols between releases, anyone with older versions won't be able to link against the binary. That's why the other Dockerfile uses an old Debian and compiles from source. So I think that might be one pre-req to merging this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I can make the change to an older version of alpine. How far back are you looking to go though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chearon I was looking at this again and I think it makes sense to leave musl at 1.1.24. They are planning to EOL the 1.1 branch with the release of 1.2 in February but will be back-porting bug fixes down to 1.1.25 in the future. Also, all versions prior to 1.1.24 have security issues.
Similar to how musl will only be supported for node versions >= 12 (released in April 2019) I don't think it's unreasonable to only "officially" support musl >= 1.1.24 (released in Oct 2019). What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to jump in - given the EOL, eventual complications and that there are no better options either ways so far - having recent support now is better than having legacy support but too late.
Probably a lot of people in the K8S world are using Alpine as a base and are struggling / consuming power to build these for nothing :)