From 5fab302d6cd40c3cb05b9b2f2a5b9a2b909962e3 Mon Sep 17 00:00:00 2001 From: v-jameslongo Date: Tue, 5 Nov 2024 15:21:15 -0500 Subject: [PATCH] Added a learning-loop image build/push (#60) * add reinforcement_learning manyliux-2_28 * add reinforcement_learning manyliux-2_28 * added manual build starting with reinforcement_learning manyliux-2_28 * added a manual learning-loop image build/push action --- .../workflows/build_deploy_learning_loop.yml | 25 +++++++++ README.md | 3 +- learning-loop/ubuntu-build.dockerfile | 55 +++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build_deploy_learning_loop.yml create mode 100644 learning-loop/ubuntu-build.dockerfile diff --git a/.github/workflows/build_deploy_learning_loop.yml b/.github/workflows/build_deploy_learning_loop.yml new file mode 100644 index 0000000..356b491 --- /dev/null +++ b/.github/workflows/build_deploy_learning_loop.yml @@ -0,0 +1,25 @@ +name: Manual build and deploy Learning Loop to DockerHub + +on: + workflow_dispatch: + +jobs: + build: + name: learning-loop-ubuntu + runs-on: ubuntu-latest + strategy: + matrix: + config: + - { image_name: learning-loop, dockerfile: ubuntu-build.dockerfile, context: ./learning-loop/ } + steps: + - uses: actions/checkout@v3 + - name: Login, build and push image + if: success() + uses: whoan/docker-build-with-cache-action@v4 + with: + username: "${{ secrets.DOCKER_USERNAME }}" + password: "${{ secrets.DOCKER_PASSWORD }}" + image_name: "vowpalwabbit/${{matrix.config.image_name}}" + dockerfile: "${{matrix.config.dockerfile}}" + context: "${{ matrix.config.context }}" + push_image_and_stages: true diff --git a/README.md b/README.md index 1076226..4309a04 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ Tags on DockerHub correspond to [tags](https://github.com/VowpalWabbit/docker-im | [CentOS 7.6.1810](./vowpal_wabbit/centos7_6_1810-build.Dockerfile) | [vowpalwabbit/centos7_6_1810-build](https://hub.docker.com/r/vowpalwabbit/centos7_6_1810-build) | CI | | [RL Ubuntu 18.04](./reinforcement_learning/ubuntu1804-build.Dockerfile) | [vowpalwabbit/rl-ubuntu-1804](https://hub.docker.com/r/vowpalwabbit/rl-ubuntu-1804) | CI | | [RL Python ManyLinux 2010](./reinforcement_learning/manylinux-2010/rlclientlib-manylinux2010-build.Dockerfile) | [vowpalwabbit/rlclientlib-manylinux2010-build](https://hub.docker.com/r/vowpalwabbit/rlclientlib-manylinux2010-build) | CI/Python packaging | -| [RL Python ManyLinux 2_28](./reinforcement_learning/manylinux-2_28/rlclientlib-manylinux-2_28-build.Dockerfile) | [vowpalwabbit/rlclientlib-manylinux-2_28-build](https://hub.docker.com/r/vowpalwabbit/rlclientlib-manylinux-2_28-build) | CI/Python packaging | +| [RL Python ManyLinux 2_28](./reinforcement_learning/manylinux-2_28/rl-manylinux-2_28-build.Dockerfile) | [vowpalwabbit/rl-manylinux-2_28-build](https://hub.docker.com/r/vowpalwabbit/rl-manylinux-2_28-build) | CI/Python packaging | +| [Learning Loop Latest](./learning-loop/ubuntu-build.dockerfile) | [vowpalwabbit/learning-loop](https://hub.docker.com/r/vowpalwabbit/learning-loop) | CI | ## Release steps diff --git a/learning-loop/ubuntu-build.dockerfile b/learning-loop/ubuntu-build.dockerfile new file mode 100644 index 0000000..c2721b5 --- /dev/null +++ b/learning-loop/ubuntu-build.dockerfile @@ -0,0 +1,55 @@ +# build stage +FROM ubuntu:jammy AS build + +# set environment variables to avoid interaction during package installation +ENV DEBIAN_FRONTEND=noninteractive + +# update the package list and install build dependencies +RUN apt-get update && apt-get install -y \ + curl \ + wget \ + git \ + build-essential \ + cmake \ + pkg-config \ + ninja-build \ + zip \ + unzip \ + tar \ + dotnet-sdk-8.0 \ + && rm -rf /var/lib/apt/lists/* + +# clone the specified repository and build the project +RUN git clone https://github.com/microsoft/learning-loop.git /tmp/learning-loop +WORKDIR /tmp/learning-loop +RUN git submodule update --init --recursive +RUN mkdir artifacts +RUN dotnet build ./OnlineTrainerExe/OnlineTrainerExe.csproj -c Release +RUN dotnet publish ./OnlineTrainerExe/OnlineTrainerExe.csproj -c Release --no-build -o /publish + +# final runtime stage +FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime + +# set environment variables to avoid interaction during package installation +ENV DEBIAN_FRONTEND=noninteractive + +# install only the necessary runtime dependencies +RUN apt-get update && apt-get install -y \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# install Azure CLI +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash && rm -rf /var/lib/apt/lists/* + +# copy the published output from the build stage +COPY --from=build /publish /app +COPY --from=build /tmp/learning-loop/artifacts/rl_sim /app/rl_sim + +WORKDIR /app + +RUN chmod 555 onlinetrainer.sh +RUN chmod 555 vw-bin/vw-* +RUN chmod 555 rl_sim.sh +RUN chmod 555 rl_sim/rl_sim-* + +ENTRYPOINT ["/bin/bash", "start-app.sh"] \ No newline at end of file