-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[native] Add dockerfiles for dependencies and runtime
These dockerfiles allow building container images for dependencies and Prestissimo runtime.
- Loading branch information
1 parent
e572b03
commit cfff317
Showing
8 changed files
with
231 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
version: '3.5' | ||
|
||
services: | ||
ubuntu-native-dependency: | ||
# Usage: | ||
# docker-compose build ubuntu-native-dependency | ||
# podman compose build ubuntu-native-dependency | ||
image: presto/prestissimo-dependency:amd64-ubuntu-22.04 | ||
build: | ||
args: | ||
- BUILD_TYPE=Release | ||
context: . | ||
dockerfile: scripts/dockerfiles/ubuntu-22.04-dependency.dockerfile | ||
|
||
ubuntu-native-runtime: | ||
# Usage: | ||
# docker-compose build ubuntu-native-runtime | ||
# podman compose build ubuntu-native-runtime | ||
image: presto/prestissimo-runtime:amd64-ubuntu-22.04 | ||
build: | ||
args: | ||
- BUILD_TYPE=Release | ||
- DEPENDENCY_IMAGE=presto/prestissimo-dependency:amd64-ubuntu-22.04 | ||
- BASE_IMAGE=amd64/ubuntu:22.04 | ||
- OSNAME=ubuntu | ||
context: . | ||
dockerfile: scripts/dockerfiles/prestissimo-runtime.dockerfile | ||
environment: | ||
NUM_THREADS: 8 # default value for NUM_THREADS | ||
|
||
centos-native-dependency: | ||
# Usage: | ||
# docker-compose build centos-native-dependency | ||
# podman compose build centos-native-dependency | ||
image: presto/prestissimo-dependency:centos8 | ||
build: | ||
args: | ||
- BUILD_TYPE=Release | ||
context: . | ||
dockerfile: scripts/dockerfiles/centos-8-stream-dependency.dockerfile | ||
|
||
centos-native-runtime: | ||
# Usage: | ||
# docker-compose build centos-native-runtime | ||
# podman compose build centos-native-runtime | ||
image: presto/prestissimo-runtime:centos8 | ||
build: | ||
args: | ||
- BUILD_TYPE=Release | ||
context: . | ||
dockerfile: scripts/dockerfiles/prestissimo-runtime.dockerfile | ||
environment: | ||
NUM_THREADS: 8 # default value for NUM_THREADS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Prestissimo - Dockerfile build | ||
|
||
> 📝 _**Note:** Please post in Presto Slack if you have any questions_ | ||
There are two kinds of Dockerfiles: | ||
1) A platform specific file to build dependencies. Current supported platforms are | ||
1) Centos-8-stream with gcc9. | ||
2) Ubuntu-22.04 with gcc11. | ||
2) A platform-agnostic file to build Prestissimo runtime on top of the dependency image. | ||
### Dependency Dockerfiles | ||
These Dockerfiles install all the dependencies including those needed for testing. | ||
A list of dependencies can be found [here](../../README.md). | ||
By default, the dependencies are built in Release mode. | ||
The Dependency Image needs to be built only when some dependency is updated. | ||
Prestissimo dependencies change infrequently. | ||
|
||
### Runtime Dockerfile | ||
This Dockerfile builds Prestissimo on top of the dependency image. | ||
There are 2 stages: | ||
* The first stage builds the Prestissimo binary. | ||
* The second stage creates a Prestissimo runtime image from | ||
a base image and copies the binary and shared libraries that are required | ||
for execution. | ||
|
||
Run the following command to see the services available to build images. | ||
``` | ||
podman compose config --services | ||
``` | ||
|
||
## Quick Start | ||
|
||
### 1. Clone the Presto repository and checkout Prestissimo submodules | ||
|
||
```bash | ||
git clone https://github.com/prestodb/presto | ||
cd presto/presto-native-execution && make submodules | ||
``` | ||
|
||
### 2. Build Dependency Image using docker/podman compose | ||
|
||
Specify the build type using the ``BUILD_TYPE`` (defaults to Release) | ||
environment variable. | ||
|
||
```bash | ||
podman compose build centos-native-dependency | ||
``` | ||
|
||
### 3. Build Runtime Image | ||
|
||
Specify the build type using ``BUILD_TYPE`` (defaults to Release) | ||
environment variable. | ||
|
||
```bash | ||
podman compose build centos-native-runtime | ||
``` |
25 changes: 25 additions & 0 deletions
25
presto-native-execution/scripts/dockerfiles/centos-8-stream-dependency.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM quay.io/centos/centos:stream8 | ||
|
||
ARG BUILD_TYPE=Release | ||
ENV PROMPT_ALWAYS_RESPOND=n | ||
ENV CC=/opt/rh/gcc-toolset-9/root/bin/gcc | ||
ENV CXX=/opt/rh/gcc-toolset-9/root/bin/g++ | ||
|
||
RUN mkdir -p /scripts /velox/scripts | ||
COPY scripts /scripts | ||
COPY velox/scripts /velox/scripts | ||
RUN mkdir build && \ | ||
(cd build && ../scripts/setup-centos.sh && ../velox/scripts/setup-adapters.sh aws) && \ | ||
rm -rf build |
42 changes: 42 additions & 0 deletions
42
presto-native-execution/scripts/dockerfiles/prestissimo-runtime.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ARG DEPENDENCY_IMAGE=presto/prestissimo-dependency:centos8 | ||
ARG BASE_IMAGE=quay.io/centos/centos:stream8 | ||
FROM ${DEPENDENCY_IMAGE} as prestissimo-image | ||
|
||
ARG OSNAME=centos | ||
ARG BUILD_TYPE=Release | ||
ARG EXTRA_CMAKE_FLAGS='' | ||
ARG NUM_THREADS=8 | ||
|
||
ENV PROMPT_ALWAYS_RESPOND=n | ||
ENV BUILD_BASE_DIR=_build | ||
ENV BUILD_DIR="" | ||
|
||
RUN mkdir -p /prestissimo /runtime-libraries | ||
COPY . /prestissimo/ | ||
RUN EXTRA_CMAKE_FLAGS=${EXTRA_CMAKE_FLAGS} \ | ||
make -j${NUM_THREADS} --directory="/prestissimo/" cmake-and-build BUILD_TYPE=${BUILD_TYPE} BUILD_DIR=${BUILD_DIR} BUILD_BASE_DIR=${BUILD_BASE_DIR} | ||
RUN ldd /prestissimo/${BUILD_BASE_DIR}/${BUILD_DIR}/presto_cpp/main/presto_server | awk 'NF == 4 { system("cp " $3 " /runtime-libraries") }' | ||
|
||
#///////////////////////////////////////////// | ||
# prestissimo-runtime | ||
#////////////////////////////////////////////// | ||
|
||
FROM ${BASE_IMAGE} | ||
|
||
ENV BUILD_BASE_DIR=_build | ||
ENV BUILD_DIR="" | ||
|
||
COPY --chmod=0775 --from=prestissimo-image /prestissimo/${BUILD_BASE_DIR}/${BUILD_DIR}/presto_cpp/main/presto_server /usr/local/bin/ | ||
COPY --chmod=0775 --from=prestissimo-image /runtime-libraries/* /usr/local/lib/ |
32 changes: 32 additions & 0 deletions
32
presto-native-execution/scripts/dockerfiles/ubuntu-22.04-dependency.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ARG base=amd64/ubuntu:22.04 | ||
FROM ${base} | ||
ARG BUILD_TYPE=Release | ||
# Set a default timezone, can be overriden via ARG | ||
ARG tz="America/New_York" | ||
ARG DEBIAN_FRONTEND="noninteractive" | ||
ENV PROMPT_ALWAYS_RESPOND=n | ||
ENV SUDO=" " | ||
# TZ and DEBIAN_FRONTEND="noninteractive" | ||
# are required to avoid tzdata installation | ||
# to prompt for region selection. | ||
ENV TZ=${tz} | ||
|
||
RUN mkdir -p /scripts /velox/scripts | ||
COPY scripts /scripts | ||
COPY velox/scripts /velox/scripts | ||
# setup-adapters.sh does not install rpm needed for minio install. | ||
RUN mkdir build && \ | ||
(cd build && ../scripts/setup-ubuntu.sh && apt install -y rpm && ../velox/scripts/setup-adapters.sh aws) && \ | ||
rm -rf build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters