Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PD-2758: Add Slide-tags docker #143

Merged
merged 32 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/build-slide-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: SlideTags CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "develop" and "master" branch
pull_request:
branches: [ "develop", "master" ]
paths:
- '3rd-party-tools/slide-tags/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
image_tag:
description: 'Docker Image Tag (default: branch_name)'

env:
PROJECT_NAME: WARP 3rd Party Tools
# Github repo name
REPOSITORY_NAME: ${{ github.event.repository.name }}
# Region-specific Google Docker repository where GOOGLE_PROJECT/REPOSITORY_NAME can be found
DOCKER_REGISTRY: us.gcr.io
GCR_PATH: broad-gotc-prod/slide-tags
ACR_PATH: slide-tags
TAG: ${{ github.event.inputs.image_tag || github.head_ref || github.ref_name }}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# The job that builds our container
build-for-gcr:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 3rd-party-tools/slide-tags
# Map a step output to a job output
outputs:
imagePath: ${{ steps.saveImagePath.outputs.url }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${DOCKER_REGISTRY}/${GCR_PATH}:${TAG}
- name: Check working directory'
run: |
echo "Current directory: "
pwd
ls -lht
# Save the image path to an output
- id: 'saveImagePath'
run: echo "url=${DOCKER_REGISTRY}/${GCR_PATH}:${TAG}" >> $GITHUB_OUTPUT
# Log into the Google Docker registry
- id: 'Auth'
name: Login to GCR
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: _json_key
password: ${{ secrets.GCR_CI_KEY }}
# Push the image to the Google Docker registry
- name: Push image
run: "docker push ${DOCKER_REGISTRY}/${GCR_PATH}:${TAG}"

build-for-acr:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 3rd-party-tools/slide-tags
steps:
# checkout the repo
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

- name: 'Login via Azure CLI'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Build and push image'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/${ACR_PATH}:${TAG}
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/${ACR_PATH}:${TAG}
100 changes: 100 additions & 0 deletions 3rd-party-tools/slide-tags/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Taken from https://github.com/MacoskoLab/Macosko-Pipelines/blob/main/positioning/Dockerfile
# Modified slightly to reduce the number of layers

FROM debian:bookworm
SHELL ["/bin/bash", "-c"]

LABEL maintainer="Broad Institute Pipeline Development Team <[email protected]"

# Install system libraries
RUN apt-get update ; \
apt-get install -y --no-install-recommends zip unzip gzip less wget curl ; \
apt-get install -y --no-install-recommends sudo tmux htop dstat socat ; \
apt-get install -y --no-install-recommends procps moreutils gnupg ; \
apt-get install -y --no-install-recommends gdebi-core build-essential alien ; \
apt-get install -y --no-install-recommends libhdf5-dev hdf5-tools libpng-dev libtiff5-dev libjpeg-dev ; \
apt-get install -y --no-install-recommends apt-transport-https ca-certificates libssl-dev libxml2-dev zlib1g-dev ; \
apt-get install -y --no-install-recommends libfreetype6-dev libcairo2-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev ; \

# Get spatial count script -- will add this line later when we have a more stable version of the script
# wget https://raw.githubusercontent.com/MacoskoLab/Macosko-Pipelines/main/spatial-count/spatial-count.jl; \

# Install Google Cloud SDK
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && apt-get update -y && apt-get install google-cloud-sdk -y ;\

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ; \
# Install Julia
wget -P /opt https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.5-linux-x86_64.tar.gz ; \
tar -xzvf /opt/julia-1.10.5-linux-x86_64.tar.gz -C /opt ; \
rm /opt/julia-1.10.5-linux-x86_64.tar.gz ; \
ln -s /opt/julia-1.10.5/bin/julia /usr/local/bin/julia ; \

# Install Julia libraries
julia -e 'using Pkg; \
Pkg.add(["CSV", \
"GZip", \
"SIMD", \
"HDF5", \
"Plots", \
"FASTX", \
"Peaks", \
"IJulia", \
"ArgParse", \
"CodecZlib", \
"PDFmerger", \
"IterTools", \
"StatsBase", \
"DataFrames", \
"StatsPlots", \
"StringViews", \
"Combinatorics", \
"Distributions", \
"LinearAlgebra", \
"LoopVectorization"])' ; \

# Install R
export R_VERSION=4.3.3 ; \
curl -O https://cdn.rstudio.com/r/debian-12/pkgs/r-${R_VERSION}_1_amd64.deb ; \
echo y | gdebi r-${R_VERSION}_1_amd64.deb ; \
sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R ; \
sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript ; \

# Install R libraries
R -e "install.packages(c('qs', \
'glue', \
'qpdf', \
'dplyr', \
'purrr', \
'furrr', \
'rlist', \
'rdist', \
'tidyr', \
'hdf5r', \
'dbscan', \
'future', \
'Seurat', \
'cowplot', \
'ggplot2', \
'ggrastr', \
'stringr', \
'viridis', \
'jsonlite', \
'magrittr', \
'gridExtra', \
'SeuratObject'), repos='http://cran.rstudio.com/')" ; \

R -e "if (!require('BiocManager',quietly=T)) {install.packages('BiocManager',repos='http://cran.rstudio.com/')}; \
BiocManager::install('rhdf5')" ; \

# Install micromamba
# curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)

# Install python + pip + jupyter
# RUN sudo ln -s /usr/bin/python3 /usr/bin/python
# RUN sudo apt-get update && sudo apt-get install python3-pip
# RUN pip install jupyterlab

# Set tini as default entrypoint
ENTRYPOINT [ "/sbin/tini", "--" ]
Loading