-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
136 lines (114 loc) · 5.34 KB
/
Dockerfile
File metadata and controls
136 lines (114 loc) · 5.34 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Copyright (C) 2023 Roberto Rossini <roberros@uio.no>
#
# SPDX-License-Identifier: MIT
##### IMPORTANT #####
# This Dockerfile requires several build arguments to be defined through --build-arg
# See utils/devel/build_dockerfile.sh for an example of how to build this Dockerfile
#####################
ARG BUILD_BASE_IMAGE=ghcr.io/paulsengroup/ci-docker-images/ubuntu-24.04-cxx-clang-20:latest
ARG FINAL_BASE_IMAGE=ubuntu:24.04
FROM "${BUILD_BASE_IMAGE}" AS builder
ARG src_dir='/root/hictk'
ARG build_dir='/root/hictk/build'
ARG staging_dir='/root/hictk/staging'
ARG install_dir='/usr/local'
# Environment variables used for building
ARG CCACHE_DISABLE=1
ARG CMAKE_BUILD_TYPE=Release
ARG CMAKE_GENERATOR=Ninja
ARG CMAKE_INSTALL_PREFIX="$staging_dir"
ARG CMAKE_POLICY_VERSION_MINIMUM=3.5
ARG CMAKE_PREFIX_PATH="$build_dir"
ARG C_STANDARD=23
ARG CXX_STANDARD=23
ARG HICTK_GIT_HASH=0000000000000000000000000000000000000000
ARG HICTK_GIT_IS_DIRTY=false
ARG HICTK_GIT_SHORT_HASH=00000000
ARG HICTK_GIT_TAG=unknown
RUN mkdir -p "$src_dir" "$build_dir"
# Build hictk deps using Conan
COPY conanfile.py "$src_dir/conanfile.py"
RUN conan install "$src_dir/conanfile.py" \
--build=missing \
-c:a=tools.cmake.cmaketoolchain:generator=Ninja \
--options='hictk/*:with_arrow=False' \
--options='hictk/*:with_benchmark_deps=False' \
--options='hictk/*:with_cli_tool_deps=True' \
--options='hictk/*:with_eigen=False' \
--options='hictk/*:with_fuzzy_testing_deps=False' \
--options='hictk/*:with_telemetry_deps=True' \
--options='hictk/*:with_unit_testing_deps=False' \
--output-folder="$build_dir" \
-pr:b="$CONAN_DEFAULT_PROFILE_PATH" \
-pr:h="$CONAN_DEFAULT_PROFILE_PATH" \
--settings=build_type=Release \
--settings=compiler.cstd="$C_STANDARD" \
--settings=compiler.cppstd="$CXX_STANDARD" \
&& conan cache clean "*" --build \
&& conan cache clean "*" --download \
&& conan cache clean "*" --source
# Copy source files
COPY LICENSE "$src_dir/"
COPY external "$src_dir/external/"
COPY cmake "$src_dir/cmake/"
COPY CMakeLists.txt "$src_dir/"
COPY src "$src_dir/src/"
# Configure project
RUN cmake -DCMAKE_C_STANDARD="$C_STANDARD" \
-DCMAKE_CXX_STANDARD="$CXX_STANDARD" \
-DCMAKE_LINKER_TYPE=LLD \
-DENABLE_DEVELOPER_MODE=OFF \
-DHICTK_ENABLE_GIT_VERSION_TRACKING=OFF \
-DHICTK_ENABLE_TESTING=OFF \
-DHICTK_GIT_DESCRIBE="$HICTK_GIT_SHORT_HASH" \
-DHICTK_GIT_HEAD_SHA1="$HICTK_GIT_HASH" \
-DHICTK_GIT_IS_DIRTY="$HICTK_GIT_IS_DIRTY" \
-DHICTK_GIT_RETRIEVED_STATE=true \
-DHICTK_GIT_TAG="$HICTK_GIT_TAG" \
-DHICTK_WITH_ARROW=OFF \
-DHICTK_WITH_EIGEN=OFF \
-S "$src_dir" \
-B "$build_dir"
# Build and install project
RUN cmake --build "$build_dir" -t hictk -j "$(nproc)" \
&& cmake --install "$build_dir" --component Runtime \
&& rm -r "$build_dir"
ARG FINAL_BASE_IMAGE=ubuntu:24.04
FROM "${FINAL_BASE_IMAGE}" AS base
ARG staging_dir='/root/hictk/staging'
ARG install_dir='/usr/local'
ARG BUILD_BASE_IMAGE=ghcr.io/paulsengroup/ci-docker-images/ubuntu-24.04-cxx-clang-20:latest
ARG FINAL_BASE_IMAGE=ubuntu
ARG HICTK_GIT_HASH=0000000000000000000000000000000000000000
ARG HICTK_GIT_SHORT_HASH=00000000
ARG HICTK_GIT_TAG=unknown
ARG HICTK_GIT_IS_DIRTY=false
ARG VERSION=latest
ARG CREATION_DATE=2000-01-01
RUN if [ "$BUILDARCH" != 'amd64' ]; then \
apt-get update \
&& apt-get install -q -y --no-install-recommends libatomic1 \
&& rm -rf /var/lib/apt/lists/*; \
fi
RUN apt-get update \
&& apt-get install -q -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Export project binaries to the final build stage
COPY --from=builder "$staging_dir" "$install_dir"
WORKDIR /data
ENTRYPOINT ["/usr/local/bin/hictk"]
RUN hictk --help
RUN hictk --version
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
LABEL org.opencontainers.image.authors='Roberto Rossini <roberros@uio.no>'
LABEL org.opencontainers.image.url='https://github.com/paulsengroup/hictk'
LABEL org.opencontainers.image.documentation='https://hictk.readthedocs.io/en/stable/'
LABEL org.opencontainers.image.source='https://github.com/paulsengroup/hictk'
LABEL org.opencontainers.image.licenses='MIT'
LABEL org.opencontainers.image.title='hictk'
LABEL org.opencontainers.image.description='Blazing fast toolkit to work with .hic and .cool files'
LABEL org.opencontainers.image.base.name="$FINAL_BASE_IMAGE"
LABEL paulsengroup.hictk.image.build-base="$BUILD_BASE_IMAGE"
LABEL org.opencontainers.image.revision="$HICTK_GIT_HASH"
LABEL org.opencontainers.image.created="$CREATION_DATE"
LABEL org.opencontainers.image.version="${VERSION:-sha-$HICTK_GIT_SHORT_HASH}"