You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by mb...@apache.org on 2022/10/27 19:08:10 UTC
[flink] 19/30: [apple] Multi-target docker file
This is an automated email from the ASF dual-hosted git repository.
mbalassi pushed a commit to branch release-1.16.0.1-acs
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 8fe687a94d004d7491377206ba7d34b2519be8d0
Author: Gabor Somogyi <ga...@apple.com>
AuthorDate: Thu Sep 8 11:40:03 2022 +0200
[apple] Multi-target docker file
---
apple/docker/{Dockerfile.hadoop => Dockerfile} | 12 ++++--
apple/docker/Dockerfile.base | 53 --------------------------
apple/docker/README.md | 4 +-
rio.yml | 8 +++-
4 files changed, 17 insertions(+), 60 deletions(-)
diff --git a/apple/docker/Dockerfile.hadoop b/apple/docker/Dockerfile
similarity index 93%
rename from apple/docker/Dockerfile.hadoop
rename to apple/docker/Dockerfile
index 8e602bb8253..5ccb1a6e327 100644
--- a/apple/docker/Dockerfile.hadoop
+++ b/apple/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM docker.apple.com/base-images/ubi8-minimal/java11-runtime
+FROM docker.apple.com/base-images/ubi8-minimal/java11-runtime as base
USER root
# Install dependencies
@@ -7,7 +7,6 @@ RUN set -ex; \
# Suboptimal fix for missing libjemalloc.so from LD_PRELOAD
RUN rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/j/jemalloc-5.2.1-2.el8.x86_64.rpm
-RUN microdnf -y install jemalloc
RUN mkdir -p /usr/lib/x86_64-linux-gnu/
RUN ln -s /usr/lib64/libjemalloc.so.2 /usr/lib/x86_64-linux-gnu/libjemalloc.so
@@ -30,7 +29,6 @@ RUN set -ex; \
chmod +x /usr/local/bin/gosu; \
gosu nobody true
-
# Prepare environment
ENV FLINK_HOME=/opt/flink
ENV PATH=$FLINK_HOME/bin:$PATH
@@ -46,6 +44,14 @@ RUN set -ex; \
\
chown -R flink:flink .;
+# Configure container
+COPY docker-entrypoint.sh /
+ENTRYPOINT ["/docker-entrypoint.sh"]
+EXPOSE 6123 8081
+CMD ["help"]
+
+FROM base as hadoop
+
ENV HADOOP_USER hdfs
ENV HADOOP_PREFIX /usr/local/hadoop-3.3.1
ENV HADOOP_COMMON_HOME /usr/local/hadoop-3.3.1
diff --git a/apple/docker/Dockerfile.base b/apple/docker/Dockerfile.base
deleted file mode 100644
index 504385be95c..00000000000
--- a/apple/docker/Dockerfile.base
+++ /dev/null
@@ -1,53 +0,0 @@
-FROM docker.apple.com/base-images/ubi8-minimal/java11-runtime
-
-USER root
-# Install dependencies
-RUN set -ex; \
- microdnf install -y wget gnupg2 curl tar hostname gettext shadow-utils findutils gzip bzip2
-
-# Suboptimal fix for missing libjemalloc.so from LD_PRELOAD
-RUN rpm -ivh https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/j/jemalloc-5.2.1-2.el8.x86_64.rpm
-RUN microdnf -y install jemalloc
-RUN mkdir -p /usr/lib/x86_64-linux-gnu/
-RUN ln -s /usr/lib64/libjemalloc.so.2 /usr/lib/x86_64-linux-gnu/libjemalloc.so
-
-# Grab gosu for easy step-down from root
-ENV GOSU_VERSION 1.11
-RUN set -ex; \
- wget -nv -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64"; \
- wget -nv -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64.asc"; \
- export GNUPGHOME="$(mktemp -d)"; \
- for server in ha.pool.sks-keyservers.net $(shuf -e \
- hkp://p80.pool.sks-keyservers.net:80 \
- keyserver.ubuntu.com \
- hkp://keyserver.ubuntu.com:80 \
- pgp.mit.edu) ; do \
- gpg --batch --keyserver "$server" --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && break || : ; \
- done && \
- gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
- gpgconf --kill all; \
- rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
- chmod +x /usr/local/bin/gosu; \
- gosu nobody true
-
-
-# Prepare environment
-ENV FLINK_HOME=/opt/flink
-ENV PATH=$FLINK_HOME/bin:$PATH
-RUN groupadd --system --gid=9999 flink && \
- /usr/sbin/useradd --system --home-dir $FLINK_HOME --uid=9999 --gid=flink flink
-WORKDIR $FLINK_HOME
-
-# Install Flink
-COPY flink.tgz $FLINK_HOME
-RUN set -ex; \
- tar -xf flink.tgz --strip-components=1; \
- rm flink.tgz; \
- \
- chown -R flink:flink .;
-
-# Configure container
-COPY docker-entrypoint.sh /
-ENTRYPOINT ["/docker-entrypoint.sh"]
-EXPOSE 6123 8081
-CMD ["help"]
diff --git a/apple/docker/README.md b/apple/docker/README.md
index 248187c1cd6..60cd1dacd59 100644
--- a/apple/docker/README.md
+++ b/apple/docker/README.md
@@ -25,13 +25,13 @@ wget https://archive.apache.org/dist/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar
Create the base image as follows, optionally replace it with your own version tag.
```bash
-docker build . -f Dockerfile.base -t docker.apple.com/acs-flink/flink:1.14.3.1-apple
+DOCKER_BUILDKIT=1 docker build . -f Dockerfile --target base -t docker.apple.com/acs-flink/flink:1.15.2.0-apple
```
Create the Hadoop image as follows:
```bash
-docker build . -f Dockerfile.hadoop -t docker.apple.com/acs-flink/flink:1.14.3.1-apple-hadoop
+DOCKER_BUILDKIT=1 docker build . -f Dockerfile --target hadoop -t docker.apple.com/acs-flink/flink:1.15.2.0-apple-hadoop
```
These images are regularly published via our Rio CI pipeline.
diff --git a/rio.yml b/rio.yml
index a4e357d04b6..b92b4dce23c 100644
--- a/rio.yml
+++ b/rio.yml
@@ -7,6 +7,8 @@ pipelines:
branchName: release-1.15-acs
machine:
baseImage: docker.apple.com/thomas-weise/flink-ci:latest
+ env:
+ DOCKER_BUILDKIT: "1"
build:
template: freestyle:v4:publish
steps:
@@ -26,14 +28,16 @@ pipelines:
- publish:
- repo: m2:oss-patched
dockerfile:
- - dockerfilePath: apple/docker/Dockerfile.base
+ - dockerfilePath: apple/docker/Dockerfile
+ target: base
context: apple/docker/
perApplication: false
version: "1-r${RIO_BUILD_NUMBER}"
extraTags: [ "latest", "1-latest" ]
publish:
- repo: docker.apple.com/acs-flink/flink-1.15-acs
- - dockerfilePath: apple/docker/Dockerfile.hadoop
+ - dockerfilePath: apple/docker/Dockerfile
+ target: hadoop
context: apple/docker/
perApplication: false
version: "1-r${RIO_BUILD_NUMBER}"