-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
113 lines (83 loc) · 3.21 KB
/
Dockerfile
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Multi-container Dockerfile for build and run containers for vg
FROM ubuntu:18.04 AS base
MAINTAINER vgteam
RUN echo base > /stage.txt
WORKDIR /vg
RUN ls -lah /vg || echo "No vg directory exists yet"
FROM base AS build
RUN echo build > /stage.txt
RUN ls -lah /vg || echo "No vg directory exists yet"
# Copy vg build tree into place
COPY . /vg
RUN ls -lah /vg || echo "No vg directory exists yet"
# Install the base packages needed to let vg install packages.
# Make sure this runs after vg sources are imported so vg will always have an
# up to date package index to get its dependencies.
# We don't need to clean the package index since we don't ship this image and
# don't care about its size.
# We don't want to install too much stuff here, because we want to test vg's
# make get-deps to make sure it isn't missing something
RUN apt-get -qq -y update && \
apt-get -qq -y upgrade && \
apt-get -qq -y install \
make \
sudo
# To increase portability of the docker image, set the target CPU architecture to
# Ivy Bridge (2012) rather than auto-detecting the build machine's CPU.
# Since we build and run protoc, we need ivybridge or later to actually build the container.
# But we then don't depend on the build host's architecture
RUN sed -i s/march=native/march=ivybridge/ deps/sdsl-lite/CMakeLists.txt
RUN make get-deps && . ./source_me.sh && env && make include/vg_git_version.hpp && CXXFLAGS=" -march=ivybridge " make -j$(nproc) && make static && strip bin/vg
ENV PATH /vg/bin:$PATH
############################################################################################
FROM build AS test
RUN echo test > /stage.txt
# The test need BWA
COPY --from=quay.io/ucsc_cgl/bwa:0.7.15--a17c6544342330f6ea7a23a37d23273ab1c52d21 /usr/local/bin/bwa /usr/local/bin/bwa
# The tests need some extra packages.
# TODO: Which of these can we remove?
# No clean necessary since we aren't shipping this
RUN apt-get -qq -y update && \
apt-get -qq -y upgrade && \
apt-get -qq -y install \
pigz \
dstat \
pv \
jq \
samtools \
tabix \
parallel \
bsdmainutils \
rs \
fontconfig-config
# Fail if any non-portable instructions were used
RUN /bin/bash -e -c 'if objdump -d /vg/bin/vg | grep vperm2i128 ; then exit 1 ; else exit 0 ; fi'
# Run tests in the middle so the final container that gets tagged is the run container.
RUN make test
############################################################################################
FROM base AS run
RUN echo run > /stage.txt
RUN ls -lah /vg || echo "No vg directory exists yet"
COPY --from=build /vg/bin/vg /vg/bin/
RUN ls -lah /vg || echo "No vg directory exists yet"
COPY --from=build /vg/scripts/* /vg/scripts/
RUN ls -lah /vg || echo "No vg directory exists yet"
# Install packages which toil-vg needs to be available inside the image, for pipes
# TODO: which of these can be removed?
# Make sure to clean so we don't ship old apt package indexes in our Docker.
RUN ls -lah /vg && \
apt-get -qq -y update && \
apt-get -qq -y upgrade && \
apt-get -qq -y install \
curl \
wget \
pigz \
dstat \
pv \
jq \
samtools \
tabix \
parallel \
fontconfig-config \
&& apt-get -qq -y clean
ENV PATH /vg/bin:$PATH