Skip to content

Commit

Permalink
Update Dockerfile and build_push_docker.sh (#1921)
Browse files Browse the repository at this point in the history
* This adjust for the lack of picard cloud jar and properly sets the picard version
so it's not listed as "snapshot"
* Update the docker build to use staged builds.
  This reduces the build size from about 1.7gb to about 650mb
  • Loading branch information
lbergelson authored Nov 29, 2023
1 parent 257c1c1 commit 98c86c4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
46 changes: 26 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
FROM eclipse-temurin:17-jdk
MAINTAINER Broad Institute DSDE <[email protected]>
ARG BASE_DOCKER=eclipse-temurin:17-jdk
ARG release=false

ARG build_command=shadowJar
ARG jar_name=picard.jar
FROM ${BASE_DOCKER} as build
LABEL stage=buildStage

# Install ant, git for building
# Install git for building
RUN apt-get update && \
apt-get --no-install-recommends install -y \
git \
r-base \
ant && \
apt-get clean autoclean && \
apt-get autoremove -y
git

# Assumes Dockerfile lives in root of the git repo. Pull source files into container
COPY / /usr/picard/
WORKDIR /usr/picard

# Build the distribution jar, clean up everything else
RUN ./gradlew ${build_command} && \
mv build/libs/${jar_name} picard.jar && \
./gradlew clean && \
rm -rf src && \
rm -rf gradle && \
rm -rf .git && \
rm gradlew && \
rm build.gradle
# download gradle then build
RUN ./gradlew -Drelease=${release} \
clean \
printVersion \
shadowJar

FROM ${BASE_DOCKER} as final
MAINTAINER Broad Institute DSDE <[email protected]>

# Install R
RUN apt-get update && \
apt-get --no-install-recommends install -y \
r-base &&\
apt-get clean autoclean && \
apt-get autoremove -y

RUN mkdir /usr/picard/

COPY --from=build /usr/picard/build/libs/picard.jar /usr/picard/

RUN mkdir /usr/working
WORKDIR /usr/working
WORKDIR /usr/working
2 changes: 1 addition & 1 deletion build_push_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ read -p "Is this really what you want to do? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
docker build -t ${PICARD_CLOUD_TAG} --build-arg build_command=cloudJar --build-arg jar_name=picardcloud.jar .
docker build -t ${PICARD_CLOUD_TAG} --build-arg release=true .
docker push ${PICARD_CLOUD_TAG}
fi

0 comments on commit 98c86c4

Please sign in to comment.