Skip to content

Commit 9c5d4bb

Browse files
committed
Add ccache to dependency image
1 parent 1fc5687 commit 9c5d4bb

File tree

4 files changed

+94
-9
lines changed

4 files changed

+94
-9
lines changed

presto-native-execution/.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.log
2+
build
3+
_build
4+
target

presto-native-execution/docker-compose.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,38 @@ services:
1919
context: .
2020
dockerfile: scripts/dockerfiles/ubuntu-22.04-dependency.dockerfile
2121

22+
ubuntu-native-dev:
23+
# Usage:
24+
# docker compose build ubuntu-native-dev
25+
# podman compose build ubuntu-native-dev
26+
image: presto/prestissimo-dependency:ubuntu-22.04
27+
build:
28+
args:
29+
# A few files in Velox require significant memory to compile and link.
30+
# Build requires 18GB of memory for 2 threads.
31+
- NUM_THREADS=2 # default value for NUM_THREADS.
32+
- DEPENDENCY_IMAGE=presto/prestissimo-dependency:ubuntu-22.04
33+
- BASE_IMAGE=ubuntu:22.04
34+
- OSNAME=ubuntu
35+
- EXTRA_CMAKE_FLAGS=-DPRESTO_ENABLE_TESTING=OFF
36+
-DPRESTO_ENABLE_PARQUET=ON
37+
-DPRESTO_ENABLE_S3=ON
38+
context: .
39+
dockerfile: scripts/dockerfiles/prestissimo-runtime.dockerfile
40+
target: prestissimo-dev
41+
stdin_open: true
42+
tty: true
43+
volumes:
44+
- ..:/presto
45+
working_dir: /presto/presto-native-execution
46+
environment:
47+
- NUM_THREADS=2 # default value for NUM_THREADS
48+
- EXTRA_CMAKE_FLAGS=-DPRESTO_ENABLE_TESTING=OFF
49+
-DPRESTO_ENABLE_PARQUET=ON
50+
-DPRESTO_ENABLE_S3=ON
51+
command: >
52+
bash -c "git config --global --add safe.directory /presto && git config --global --add safe.directory /presto/presto-native-execution/velox && ccache -sz -v && exec bash -i"
53+
2254
ubuntu-native-runtime:
2355
# Usage:
2456
# docker compose build ubuntu-native-runtime
@@ -47,6 +79,35 @@ services:
4779
context: .
4880
dockerfile: scripts/dockerfiles/centos-dependency.dockerfile
4981

82+
centos-native-dev:
83+
# Usage:
84+
# docker compose build centos-native-dev
85+
# podman compose build centos-native-dev
86+
image: presto/prestissimo-dependency:centos9
87+
build:
88+
args:
89+
# A few files in Velox require significant memory to compile and link.
90+
# Build requires 18GB of memory for 2 threads.
91+
- NUM_THREADS=2 # default value for NUM_THREADS
92+
- EXTRA_CMAKE_FLAGS=-DPRESTO_ENABLE_TESTING=OFF
93+
-DPRESTO_ENABLE_PARQUET=ON
94+
-DPRESTO_ENABLE_S3=ON
95+
context: .
96+
dockerfile: scripts/dockerfiles/prestissimo-runtime.dockerfile
97+
target: prestissimo-dev
98+
stdin_open: true
99+
tty: true
100+
volumes:
101+
- ..:/presto
102+
working_dir: /presto/presto-native-execution
103+
environment:
104+
- NUM_THREADS=2 # default value for NUM_THREADS
105+
- EXTRA_CMAKE_FLAGS=-DPRESTO_ENABLE_TESTING=OFF
106+
-DPRESTO_ENABLE_PARQUET=ON
107+
-DPRESTO_ENABLE_S3=ON
108+
command: >
109+
bash -c "echo 'unset LANG' >> /root/.bashrc && git config --global --add safe.directory /presto && git config --global --add safe.directory /presto/presto-native-execution/velox && ccache -sz -v && exec bash -i"
110+
50111
centos-native-runtime:
51112
# Usage:
52113
# docker compose build centos-native-runtime

presto-native-execution/scripts/dockerfiles/prestissimo-runtime.dockerfile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,38 @@ FROM ${DEPENDENCY_IMAGE} as prestissimo-image
1616

1717
ARG OSNAME=centos
1818
ARG BUILD_TYPE=Release
19+
ARG BUILD_DIR='release'
1920
ARG EXTRA_CMAKE_FLAGS=''
2021
ARG NUM_THREADS=8
2122

2223
ENV PROMPT_ALWAYS_RESPOND=n
24+
ENV BUILD_ROOT=/presto/presto-native-execution
2325
ENV BUILD_BASE_DIR=_build
24-
ENV BUILD_DIR=""
26+
ENV CCACHE_NOHASHDIR=true
27+
ENV CCACHE_BASEDIR=${BUILD_ROOT}
2528

26-
RUN mkdir -p /prestissimo /runtime-libraries
27-
COPY . /prestissimo/
28-
RUN EXTRA_CMAKE_FLAGS=${EXTRA_CMAKE_FLAGS} \
29-
NUM_THREADS=${NUM_THREADS} make --directory="/prestissimo/" cmake-and-build BUILD_TYPE=${BUILD_TYPE} BUILD_DIR=${BUILD_DIR} BUILD_BASE_DIR=${BUILD_BASE_DIR}
30-
RUN !(LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd /prestissimo/${BUILD_BASE_DIR}/${BUILD_DIR}/presto_cpp/main/presto_server | grep "not found") && \
31-
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd /prestissimo/${BUILD_BASE_DIR}/${BUILD_DIR}/presto_cpp/main/presto_server | awk 'NF == 4 { system("cp " $3 " /runtime-libraries") }'
29+
RUN mkdir -p ${BUILD_ROOT} /runtime-libraries
30+
COPY . ${BUILD_ROOT}
31+
RUN EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS}" \
32+
NUM_THREADS=${NUM_THREADS} make --directory="${BUILD_ROOT}" cmake-and-build BUILD_TYPE=${BUILD_TYPE} BUILD_DIR=${BUILD_DIR} BUILD_BASE_DIR=${BUILD_BASE_DIR} && \
33+
ccache -sz -v
34+
RUN !(LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd ${BUILD_ROOT}/${BUILD_BASE_DIR}/${BUILD_DIR}/presto_cpp/main/presto_server | grep "not found") && \
35+
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd ${BUILD_ROOT}/${BUILD_BASE_DIR}/${BUILD_DIR}/presto_cpp/main/presto_server | awk 'NF == 4 { system("cp " $3 " /runtime-libraries") }'
36+
37+
#/////////////////////////////////////////////
38+
# prestissimo-dev
39+
#//////////////////////////////////////////////
40+
41+
FROM ${DEPENDENCY_IMAGE} as prestissimo-dev
42+
43+
ENV PROMPT_ALWAYS_RESPOND=n
44+
ENV BUILD_ROOT=/presto/presto-native-execution
45+
ENV BUILD_BASE_DIR=_build
46+
ENV CCACHE_NOHASHDIR="true"
47+
ENV CCACHE_BASEDIR=/presto/presto-native-execution
48+
49+
COPY --from=prestissimo-image /root/.cache/ccache /root/.cache/ccache
50+
RUN ccache -sz -v
3251

3352
#/////////////////////////////////////////////
3453
# prestissimo-runtime
@@ -37,9 +56,9 @@ RUN !(LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64 ldd /pr
3756
FROM ${BASE_IMAGE}
3857

3958
ENV BUILD_BASE_DIR=_build
40-
ENV BUILD_DIR=""
59+
ARG BUILD_DIR='release'
4160

42-
COPY --chmod=0775 --from=prestissimo-image /prestissimo/${BUILD_BASE_DIR}/${BUILD_DIR}/presto_cpp/main/presto_server /usr/bin/
61+
COPY --chmod=0775 --from=prestissimo-image /presto/presto-native-execution/${BUILD_BASE_DIR}/${BUILD_DIR}/presto_cpp/main/presto_server /usr/bin/
4362
COPY --chmod=0775 --from=prestissimo-image /runtime-libraries/* /usr/lib64/prestissimo-libs/
4463
COPY --chmod=0755 ./etc /opt/presto-server/etc
4564
COPY --chmod=0775 ./entrypoint.sh /opt/entrypoint.sh

presto-native-execution/scripts/dockerfiles/ubuntu-22.04-dependency.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ENV SUDO=" "
2222
# are required to avoid tzdata installation
2323
# to prompt for region selection.
2424
ENV TZ=${tz}
25+
ENV LDFLAGS="-no-pie"
2526

2627
RUN mkdir -p /scripts /velox/scripts
2728
COPY scripts /scripts

0 commit comments

Comments
 (0)