Skip to content

Commit

Permalink
Restore Docker image to build process
Browse files Browse the repository at this point in the history
  • Loading branch information
kvg committed Oct 15, 2024
1 parent 89785a1 commit b006d1a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 49 deletions.
60 changes: 30 additions & 30 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
- 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 }}
42 changes: 23 additions & 19 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand All @@ -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
Expand All @@ -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"]
CMD ["/bin/bash"]

# Copy hidive binary from Github action artifact
COPY ./target/release/hidive /usr/local/bin/hidive

0 comments on commit b006d1a

Please sign in to comment.