From b006d1a7abce52ab20de55eb12e9934f0a6edc4f Mon Sep 17 00:00:00 2001 From: Kiran Garimella Date: Tue, 15 Oct 2024 03:25:56 -0400 Subject: [PATCH] Restore Docker image to build process --- .github/workflows/cd.yml | 60 ++++++++++++++++++++-------------------- docker/Dockerfile | 42 +++++++++++++++------------- 2 files changed, 53 insertions(+), 49 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ce0f4a33..1dd27a3d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -73,37 +73,37 @@ jobs: asset_name: hidive-${{ steps.version-bump.outputs.new_ver }} asset_content_type: application/octet-stream - # - name: Authenticate to Google Cloud - # id: 'auth' - # uses: 'google-github-actions/auth@v1' - # with: - # credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' + - name: Authenticate to Google Cloud + id: 'auth' + uses: 'google-github-actions/auth@v1' + with: + credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - # - name: Cache Docker layers - # uses: actions/cache@v3 - # with: - # path: /tmp/.buildx-cache - # key: ${{ runner.os }}-buildx-${{ github.sha }} - # restore-keys: | - # ${{ runner.os }}-buildx- + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- - # - name: Configure Docker to use gcloud credentials - # run: gcloud auth configure-docker us.gcr.io -q + - name: Configure Docker to use gcloud credentials + run: gcloud auth configure-docker us.gcr.io -q - # - name: Build and push Docker image - # uses: docker/build-push-action@v4 - # with: - # context: ./docker - # push: true - # tags: us.gcr.io/broad-dsp-lrma/lr-hidive:${{ steps.version-bump.outputs.new_ver }} - # build-args: | - # branch=v${{ steps.version-bump.outputs.new_ver }} - # cache-from: | - # type=local,src=/tmp/.buildx-cache - # type=gha,scope=${{ github.workflow }} - # cache-to: | - # type=local,dest=/tmp/.buildx-cache-new,mode=max - # type=gha,mode=max,scope=${{ github.workflow }} \ No newline at end of file + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: ./docker + push: true + tags: us.gcr.io/broad-dsp-lrma/lr-hidive:${{ steps.version-bump.outputs.new_ver }} + build-args: | + branch=v${{ steps.version-bump.outputs.new_ver }} + cache-from: | + type=local,src=/tmp/.buildx-cache + type=gha,scope=${{ github.workflow }} + cache-to: | + type=local,dest=/tmp/.buildx-cache-new,mode=max + type=gha,mode=max,scope=${{ github.workflow }} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index e30b5c16..7e51d448 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -38,23 +38,23 @@ RUN pip3 uninstall -y crcmod && \ # Fix python malloc bug RUN echo 'export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4"' >> ~/.bashrc -# Create known hosts for github ssh info -RUN mkdir -p ~/.ssh && \ - touch ~/.ssh/known_hosts && \ - ssh-keyscan github.com >> ~/.ssh/known_hosts - -# Install cargo -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y -ENV PATH="/root/.cargo/bin:${PATH}" - -# Install hidive -RUN git clone https://github.com/broadinstitute/hidive.git && \ - cd hidive && \ - git checkout $branch && \ - cargo build --release && \ - cp target/release/hidive /usr/local/bin/ && \ - cd .. && \ - rm -rf hidive +# # Create known hosts for github ssh info +# RUN mkdir -p ~/.ssh && \ +# touch ~/.ssh/known_hosts && \ +# ssh-keyscan github.com >> ~/.ssh/known_hosts + +# # Install cargo +# RUN curl https://sh.rustup.rs -sSf | sh -s -- -y +# ENV PATH="/root/.cargo/bin:${PATH}" + +# # Install hidive +# RUN git clone https://github.com/broadinstitute/hidive.git && \ +# cd hidive && \ +# git checkout $branch && \ +# cargo build --release && \ +# cp target/release/hidive /usr/local/bin/ && \ +# cd .. && \ +# rm -rf hidive # Install minimap2 RUN wget -O minimap2-2.28.tar.bz2 https://github.com/lh3/minimap2/releases/download/v2.28/minimap2-2.28.tar.bz2 && \ @@ -78,7 +78,8 @@ RUN wget -O samtools-1.21.tar.bz2 https://github.com/samtools/samtools/releases/ FROM python:3.9-slim # Copy necessary files from builder stage -COPY --from=builder /usr/local/bin/hidive /usr/local/bin/hidive +#COPY --from=builder /usr/local/bin/hidive /usr/local/bin/hidive + COPY --from=builder /usr/local/bin/minimap2 /usr/local/bin/minimap2 COPY --from=builder /usr/local/bin/samtools /usr/local/bin/samtools COPY --from=builder /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4 /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4 @@ -91,4 +92,7 @@ ENV PATH="/root/.cargo/bin:/google-cloud-sdk/bin:${PATH}" ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4" # We want this to be interactive -CMD ["/bin/bash"] \ No newline at end of file +CMD ["/bin/bash"] + +# Copy hidive binary from Github action artifact +COPY ./target/release/hidive /usr/local/bin/hidive