Skip to content

Commit

Permalink
Merge pull request #198 from wtsi-npg/devel
Browse files Browse the repository at this point in the history
Merge from devel to create release 0.17.1
  • Loading branch information
jmtcsngr authored Sep 14, 2023
2 parents 4067fc1 + e0facbb commit 4c25263
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "Create release"

on:
push:
tags:
- "**"

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l -e -o pipefail {0}
env:
IMAGE_NAME: bambi
REPOSITORY_OWNER: ${{ github.repository_owner }}

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Fetch Tags"
# Workaround for https://github.com/actions/checkout/issues/290
run: git fetch --tags --force

- name: "Get release variables"
# RELEASE_VERSION assignment must match the command used in autoconf's
# configure.ac file. On update, care should be taken to maintain both
# sides congruent.
run: |
echo 'RELEASE_VERSION='$(git describe --always --tags --dirty) >> $GITHUB_ENV
echo 'GIT_URL='$(git remote get-url origin) >> $GITHUB_ENV
echo 'GIT_COMMIT='$(git log --pretty=format:'%H' -n 1) >> $GITHUB_ENV
- name: "Login to Docker registry"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Build Docker image"
run: |
set -x
docker build --rm \
--file docker/Dockerfile \
--build-arg HTSLIB_BRANCH=1.18 \
--platform linux/amd64 \
--progress plain \
--load \
--label "org.opencontainers.image.title=bambi" \
--label "org.opencontainers.image.source=${GIT_URL}" \
--label "org.opencontainers.image.revision=${GIT_COMMIT}" \
--label "org.opencontainers.image.version=${RELEASE_VERSION}" \
--label "org.opencontainers.image.created=$(date --utc --iso-8601=seconds)" \
--tag "ghcr.io/$REPOSITORY_OWNER/${IMAGE_NAME}:${RELEASE_VERSION}" \
--tag "ghcr.io/$REPOSITORY_OWNER/${IMAGE_NAME}:latest" \
.
- name: "Push image to registry"
run: |
docker push "ghcr.io/$REPOSITORY_OWNER/$IMAGE_NAME:$RELEASE_VERSION"
docker push "ghcr.io/$REPOSITORY_OWNER/$IMAGE_NAME:latest"
52 changes: 52 additions & 0 deletions .github/workflows/lint-and-test-build-dockerfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Lint and test-build Dockerfile"

on:
push:
branches:
- '**'

jobs:
lint-docker:
runs-on: ubuntu-latest

continue-on-error: true

defaults:
run:
shell: "bash -l -e -o pipefail {0}"

steps:
- name: "Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Lint Dockerfile"
run: |
cat <<EOT >> .hadolint.yaml
ignored:
- DL3008
EOT
docker run --rm -i -v /"${PWD}"/.hadolint.yaml:/.config/hadolint.yaml ghcr.io/hadolint/hadolint < docker/Dockerfile
build-docker:
runs-on: ubuntu-latest

defaults:
run:
shell: "bash -l -e -o pipefail {0}"

steps:
- name: "Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Docker build"
run: |
set -x
docker build --rm \
--file docker/Dockerfile \
--build-arg HTSLIB_BRANCH=1.18 \
--tag bambi .
docker run bambi bambi --version
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[0.17.1]
Add docker tooling and image publishing

[0.17.0]
Change the --nocall-quality option from an integer to boolean, and ensure it applies to QT tags.

Expand Down
84 changes: 84 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
FROM debian:bookworm AS htslib_build

ARG HTSLIB_BRANCH

# hadolint ignore=DL3003
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
apt-get install -qq -y --no-install-recommends \
autoconf \
automake \
autotools-dev \
build-essential \
ca-certificates \
git \
libbz2-dev \
libcurl4-openssl-dev \
libgd-dev \
liblzma-dev \
libssl-dev \
&& \
export HTSLIB=/usr/local/src/htslib && \
git clone --depth 1 --branch "${HTSLIB_BRANCH}" https://github.com/samtools/htslib.git "${HTSLIB}" && \
cd "${HTSLIB}" && \
git submodule update --init --recursive && \
mkdir -p /tmp/usr/local && \
autoreconf -i && \
./configure --prefix=/tmp/usr/local && \
make && \
make install

FROM debian:bookworm AS bambi_build

COPY --from=htslib_build /tmp/usr/local /usr/local
COPY . /usr/local/src/bambi

WORKDIR /usr/local/src/bambi

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
apt-get install -qq -y --no-install-recommends \
autoconf \
automake \
autotools-dev \
build-essential \
bzip2 \
git \
libbz2-dev \
libcurl4-openssl-dev \
libtool \
libgd-dev \
liblzma-dev \
libxml2-dev \
libz-dev \
libssl-dev \
&& \
export PREFIX=/tmp/usr/local && \
autoreconf -fi && \
CPPFLAGS="-I$PREFIX/include" LDFLAGS="-Wl,-rpath,$PREFIX/lib -L$PREFIX/lib" \
./configure --prefix="$PREFIX" --with-htslib="$PREFIX" && \
make CPPFLAGS="-I$PREFIX/include" LDFLAGS="-L$PREFIX/lib" && \
make install prefix="$PREFIX"

FROM debian:bookworm AS bambi

COPY --from=htslib_build /tmp/usr/local /usr/local
COPY --from=bambi_build /tmp/usr/local /usr/local

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
apt-get install -qq -y --no-install-recommends \
libbz2-1.0 \
libcurl4 \
libgd3 \
liblzma5 \
libxml2 \
libz1 \
libssl3 \
&& \
apt-get remove -q -y unattended-upgrades && \
apt-get autoremove -q -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

CMD ["/bin/bash"]

0 comments on commit 4c25263

Please sign in to comment.