ai-traders / liget

NuGet server and cache running on kestrel in docker
MIT License
216 stars 29 forks source link

How would I build the docker image locally on Windows? #17

Closed Anapher closed 5 years ago

Anapher commented 5 years ago

Hey, I made some modifications to Liget and want to deploy them to my server as a docker image. I'm using Windows 10 as development system, so how would I build the docker image here?

My idea: Create a new development docker image based on debian, install git and docker, clone this repo and follow the steps of .travis.yml, but I'm having some problems getting Docker running in Docker.

Is there any easier way to accomplish this?

tomzo commented 5 years ago

Hi, I have little experience with using docker on Windows. I think one of the easy ways to build your fork in this case would be to virtualize linux with virtualbox, where you could have a fully functional docker. Maybe docker-machine could help with that. Then install git and dojo and proceed as in travis or GoCD pipeline config.(see also the development in readme). If you want to skip tests, from linux, it would suffice to run:

dojo "./build.sh --target Build"
./tasks.sh build_docker

If you go a different way. You would have to install dotnet core, FAKE, paket, nodejs and all the testing tools. But FYI, the docker build is quite simple, it only requires that src/LiGet/bin/Release/netcoreapp2.1/publish folder can been produced. Then docker build -t liget . is enough to build an image.

Anapher commented 5 years ago

Alright, I will try to virtualize Linux, thank you. One problem I had when just building (and then running) the docker image in Windows was an error I could not solve: /bin/sh: 1: /app/run.sh: not found

I already verified that this file does actually exist in the container (and it's executable)

Anapher commented 5 years ago
vincent@debian-dev-pc:~/liget$ sudo ./tasks.sh build
2019/05/31 05:41:12 [ 1]  INFO: (main.main) Dojo version 0.4.0
2019/05/31 05:41:12 [17]  WARN: (main.warnGeneral) Current user is root, which is not recommended
2019/05/31 05:41:12 [17]  INFO: (main.DockerDriver.HandleRun) docker command will be:
 docker run --rm -v /home/vincent/liget:/dojo/work -v /root:/dojo/identity:ro --env-file=/tmp/dojo-environment-dojo-liget-2019-05-31_05-41-12-40914748 -v /tmp/.X11-unix:/tmp/.X11-unix -ti --name=dojo-liget-2019-05-31_05-41-12-40914748 kudulab/dotnet-dojo:stretch-3.1.0 "./tasks.sh _build"
31-05-2019 09:41:13 Dojo entrypoint info: Sourcing: /etc/dojo.d/variables/50-variables.sh
31-05-2019 09:41:13 Dojo entrypoint info: Sourcing: /etc/dojo.d/scripts/20-setup-identity.sh
/dojo/identity/.ssh does not exist. You won't be able to git clone over ssh
/dojo/identity/.ssh/id_rsa does not exist. You won't be able to git clone over ssh
cp: cannot stat '/dojo/identity/.ssh': No such file or directory

There seems to be an issue with dojo, do you have an idea what is going wrong here?

tomzo commented 5 years ago

@Anapher sorry, that's a bug in the image. To workaround, on the docker host, create ~/.ssh directory with mkdir -p ~/.ssh. Also, you should not run with root account using sudo. Just run ./tasks.sh build. If you cannot access docker as vincent user, add the user to docker group with sudo usermod -aG docker vincent and log-in to a new terminal/ open a new ssh session.

Anapher commented 5 years ago

Thank you very much, that worked