osx - Add your application to a Docker image -


i implementing docker container compile (build) code in c++. platforms supported code windows, linux , mac osx.

i using clang on mac machine compile code; gcc on linux , microsoft compiler(cl) on windows. idea create docker container , perform builds(of both linux , mac) on windows machine (inside docker container) don't have push code git; pull mac machine , build , on.

the image using perform mac build (since using clang on mac osx) https://hub.docker.com/r/rsmmr/clang/.

i want add executable image testing purpose. called 'testapp'.

so image should have following components: base os + clang + testapp.

how can add executable 'testapp' (say: application/utlity) image 'rsmmr/clang'(which pulled dockerhub) ?

do via dockerfile (how?)? there other way accomplish same?

one of simple way solve mounting source/binary testapp clang image.

to demonstrate this, created testapp.cc myself , looked this:

[anovil@ubuntu-anovil add_application_docker_image]$ cat testapp.cc  #include <iostream>  using namespace std;  int main() {     cout << "hello world!" << endl;     return 0; } [anovil@ubuntu-anovil add_application_docker_image]$  

then, launched rsmmr/clang container passing local directory container plus running compilation command this:

[anovil@ubuntu-anovil add_application_docker_image]$ docker run -v $(pwd):/mnt -it rsmmr/clang /opt/llvm/bin/clang++ --std=c++11 --stdlib=libc++ /mnt/testapp.cc -o /mnt/a.out [anovil@ubuntu-anovil add_application_docker_image]$  

after this, a.out in local directory (as mounted container).

[anovil@ubuntu-anovil add_application_docker_image]$ ls a.out  testapp.cc [anovil@ubuntu-anovil add_application_docker_image]$  

if want execute binary inside container, can well.

[anovil@ubuntu-anovil add_application_docker_image]$ docker run -v $(pwd):/mnt -it rsmmr/clang /mnt/a.out hello world! [anovil@ubuntu-anovil add_application_docker_image]$  

you similar things other compilers well. not have windows machine, should work :) wanted?

let me know how went.

thanks,

  • anoop

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -