The link in the Dockerfile above doesn't work. I have my own rudimentary container running. I'm using C#. Compiling locally and then mounting/copying running inside of Docker defeats the purpose of using Docker in the first place... I need to look at the command line arguments to be able to pass in the config file instead of it getting build in, but for now... if you create a directory with your algorithm file, a copy of the `QuantConnect.Algorithm.CSharp.csproj`, renamed to "proj.csproj", and your file with your algorithm file in the "includes" section, and then the config.json file, and then use this for the Dockerfile.
For example, my algo test file is called "NabeelTestAlgo.cs", open the proj.csproj file, and add this where the other `<Compile Include="..." />` files are:
<Compile Include="NabeelTestAlgo.cs" />
Then the Dockerfile:
FROM mono:6.8.0.96
WORKDIR /opt/Lean
RUN apt-get update && apt-get -y install git nuget
RUN git clone https://github.com/QuantConnect/Lean.git /opt/Lean
RUN nuget restore QuantConnect.Lean.sln
COPY config.json Launcher/config.json
COPY proj.csproj Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj
COPY *.cs Algorithm.CSharp/
RUN msbuild QuantConnect.Lean.sln "/p:RunTest=false"
CMD ["mono", "Launcher/bin/Debug/QuantConnect.Lean.Launcher.exe"]
Then build and run:
docker build -t quantconnect:latest .
docker run quantconnect:latest
This takes advantage of Dockers stage caching, and the csproj editing is required of the dumb way includes are treated by the csproj files. If QuantConnect fixes the build so it can use the .NET Core format, then this hack of having to create a copy of the csproj file will work.
If you use docker-compose, you can mount the Data directories, etc, so that it won't store them in the container.
Right now, I have a solution (I use Rider) which just pulls in the QC libraries from nuget, instead of the full Lean build... which is a pain in the butt to rebase, etc when there are changes. This container is also much more lightweight than the one supplied.