-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-docker.sh
executable file
·25 lines (20 loc) · 1.37 KB
/
build-docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
TARGET_DIR=~/mzrecal-docker
mkdir -p $TARGET_DIR
# Obtain version number from git
VERSION=$(git describe --abbrev --dirty --always --tags)
VERSION=${VERSION#"v"}
# build flags are set to create a binairy reproducable, fully statically linked executable that includes the Git version number
# -trimpath: don't inlude full source code path names in the executable. Needed to produce binairy reproducable output.
# -ldflags:
# -buildid= : clear the buildid, needed to produce binairy reproducable output
# -X main.progVersion=${VERSION} : include Git version info (from enviroment variable ${VERSION}).
# This will probably be replaced by using function debug.ReadBuildInfo() from package "runtime/debug" in the future,
# so that we don't need this build script anymore
echo 'Building mzrecal for Linux/amd64'
GOOS=linux GOARCH=amd64 go build -trimpath -a -ldflags "-buildid= -X main.progVersion=${VERSION}" -o $TARGET_DIR/mzrecal
# Create Docker image
cp Dockerfile $TARGET_DIR
( DIR=$PWD; cd $TARGET_DIR ; docker build --tag robmarissen/mzrecal:${VERSION} . )
# Use as:
# docker run -v /home/robm/data:/data mzrecal /mzrecal -scorefilter="MS:1002257(0.0:1e0)" -mzid="/data/msrecal_ribosomes/human_ribosome_60S_bottomup_peak.mzid" -cal="/data/msrecal_ribosomes/human_ribosome_60S_bottomup_peak.recal.json" "/data/msrecal_ribosomes/human_ribosome_60S_bottomup_peak.mzML"