-
Notifications
You must be signed in to change notification settings - Fork 80
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
Optionally Run Cross Build? #18
Comments
Oh, there are no tags so can't tag this issue as a question. |
@bitbier I banged my head for a long time trying to accomplish architecture parameterized dockerfiles but unfortunately Docker won't replace variables. However you made me think about it again and I think there is a solution! It's a bit more verbose but I think if we have a dockerfile like this: FROM balenalib/crossbuild
FROM raspbian
COPY --from=0 /xbuild /bin
RUN [ "xbuild", "start" ]
RUN ...
RUN [ "xbuild", "end" ] And @nghiant2710 we should build this, it should be fairly easy to make |
Nice that would be awesome |
@petrosagg sorry, I missed this one. I will set up the |
We've got this working with:
|
I haven't tested this out yet, but doesn't the balena variables only exist for Also these variables are only applied when building in Balena, so if you have Circle CI or some other CI process, you may need to do something like:
^ untested. May work to see if I can get this done sometime this week, but it would be nice to just have the multi-arch repo for the crossbuild as suggested above. |
@jgentes @bitbier I don't think any approach based on The reason is that the if statement itself will be ran by |
I haven't. Right now we just have two separate Dockerfiles, one for CI and one for balena build/deployments. I was going to try it later this week, but I also think that you are right. I don't think it will work because it'll run in bash or sh like you stated above. |
@petrosagg I have tested it, and it works, however I'm only building on Balena - one app for x86 and the other for ARM. My base image is debian-node:10 so perhaps that's why it works on both. |
Right, that's why. Our balena builders do some magic when they have to cross compile. Namely, we bind mount a qemu binary in the container and we have binfmt set up for emulation |
Another note.. building locally, my box shows up as amd64 so my line ultimately reads:
|
This is more a question and I'll tag it as such:
Is there a way to optionally check some kind of environment variable that if it exists, will not run
cross-build-start
? I ask because I've been trying to figure out a way of keeping the same Dockerfile for both building in CI (x86) and building on balena (ARM). Right now I have to have two separate Dockerfiles to build the same image minus the wrapping the installation code inside theThanks!
The text was updated successfully, but these errors were encountered: