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

[turborepo] Unable to build Alpine docker image with turbo@canary #3083

Closed
weyert opened this issue Dec 20, 2022 · 11 comments
Closed

[turborepo] Unable to build Alpine docker image with turbo@canary #3083

weyert opened this issue Dec 20, 2022 · 11 comments
Assignees
Labels
kind: bug Something isn't working linear

Comments

@weyert
Copy link
Contributor

weyert commented Dec 20, 2022

What version of Turborepo are you using?

1.7.0@canary

What package manager are you using / does the bug impact?

npm

What operating system are you using?

Mac

Describe the Bug

I am trying to build a Alpine-based docker image with the latest canary version of turbo but it's failing with libc

Expected Behavior

Able to successfully build a Alpine-based docker image

To Reproduce

Run docker build -f ./Dockerfile . were the Dockerfile has the following contents:

# syntax = docker/dockerfile:1.2
FROM node:lts-alpine3.17 as installer


RUN mkdir -p /opt/app && chown node /opt/app && chgrp node /opt/app && mkdir -p /opt/app/patches && chown node /opt/app/patches && chgrp node /opt/app/patches

ENV NO_UPDATE_NOTIFIER=true

# Install the libc compatibility layer for Alpine
RUN apk add --no-cache tree libc6-compat ca-certificates && \
    update-ca-certificates
RUN apk update

# Install the most recent version of NPM v8
RUN npm install -g npm@8 turbo@canary

Reproduction Repo

No response

@weyert weyert added area: turborepo kind: bug Something isn't working labels Dec 20, 2022
@tknickman
Copy link
Member

tknickman commented Dec 20, 2022

@weyert thanks for reporting this.

Our ubuntu binaries require glibc now, but we should definitely support alpine, which means we'll need a new binary targeting musl (x86_64-unknown-linux-musl) I believe. I'll take a look into this

@weyert
Copy link
Contributor Author

weyert commented Dec 20, 2022

Yeah, I think in 1.6.3 you needed libc6-compat to make it work with Alpine but that approach doesn’t work with 1.7 anymore

when I replace turbo instead of turbo@canary the docker image build succeeds

@tknickman
Copy link
Member

Yep, there's a short description of the general issue here #3039. But we're still chasing them all down as part of the move to Rust.

@weyert
Copy link
Contributor Author

weyert commented Dec 21, 2022

Do you think it is fixable? Love to try Turborepo 1.7 in Alpine on Gitlab CI without needing to switch distros

If I install gcompat via apk add gcompat then I am getting the following error during my docker build:

#14 12.43 npm ERR! Error: Command failed: /opt/app/node_modules/turbo/bin/turbo --version --skip-infer
#14 12.43 npm ERR! Error relocating /opt/app/node_modules/turbo/bin/turbo: __res_init: symbol not found

Looks like there were similar issues in the Next project: vercel/next.js#30713

@tknickman
Copy link
Member

It should be yes, we've been looking into this one over the past day or so - we definitely want this to be supported out of the box with no (or minimal changes) needed in an alpine container.

@weyert
Copy link
Contributor Author

weyert commented Jan 4, 2023

This is still a problem for me. Any news @tknickman ?

@tknickman
Copy link
Member

tknickman commented Jan 6, 2023

@weyert Yep! This will be fixed in the next canary (not yet released). This one took a bit to track down and figure out a suitable approach to a fix - so my apologizes for the delay.

You can take a look at the fix and follow along in: #3189 and #3192

You will still need libc6-compat, but other than that it should work totally fine on alpine

@tknickman tknickman self-assigned this Jan 6, 2023
@weyert
Copy link
Contributor Author

weyert commented Jan 6, 2023

Awesome, thank you, let me know when you want me to try it out :)

@tknickman
Copy link
Member

Latest canary is working in Alpine - we're doing a bit more testing before a full release, but it's close enough to bang on a bit

@ronaldburns
Copy link

Been following this issue as we've had the same problem. Can confirm 1.7.0-canary.7 has fixed this for us.
Thank you!

@tknickman
Copy link
Member

Thanks for testing this out @ronaldburns / @weyert! We really appreciate it.

I'm going to close this for now (1.7.0 should be landing in the next day or two) - but please open a new issue or comment here if you see any other issue with the canary in Alpine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working linear
Projects
None yet
Development

No branches or pull requests

3 participants