forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfe-ubi.Dockerfile
More file actions
64 lines (49 loc) · 2.51 KB
/
Copy pathfe-ubi.Dockerfile
File metadata and controls
64 lines (49 loc) · 2.51 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
# This docker file build the Starrocks fe ubi8 image
# NOTE: temporary solution, use centos7 artifacts to deliver fe/be/cn/allin1 image
#
# Please run this command from the git repo root directory to build:
# - Use artifact image to package runtime container:
# > DOCKER_BUILDKIT=1 docker build --build-arg ARTIFACT_SOURCE=image --build-arg ARTIFACTIMAGE=starrocks/artifacts-centos7:latest -f docker/dockerfiles/fe/fe-ubi.Dockerfile -t fe-ubi:latest .
# - Use locally build artifacts to package runtime container:
# > DOCKER_BUILDKIT=1 docker build --build-arg ARTIFACT_SOURCE=local --build-arg LOCAL_REPO_PATH=. -f docker/dockerfiles/fe/fe-ubi.Dockerfile -t fe-ubi:latest .
#
# The artifact source used for packing the runtime docker image
# image: copy the artifacts from a artifact docker image.
# local: copy the artifacts from a local repo. Mainly used for local development and test.
ARG ARTIFACT_SOURCE=image
# The default run_as user when starting the container
ARG RUN_AS_USER=root
# The precreated non-privileged user account, the owner of the starrocks assets
ARG USER=starrocks
ARG ARTIFACTIMAGE=starrocks/artifacts-centos7:latest
FROM ${ARTIFACTIMAGE} as artifacts-from-image
# create a docker build stage that copy locally build artifacts
FROM busybox:latest as artifacts-from-local
ARG LOCAL_REPO_PATH
COPY ${LOCAL_REPO_PATH}/output/fe /release/fe_artifacts/fe
FROM artifacts-from-${ARTIFACT_SOURCE} as artifacts
FROM registry.access.redhat.com/ubi8/ubi:8.7
ARG STARROCKS_ROOT=/opt/starrocks
RUN yum install -y java-11-openjdk-devel tzdata openssl curl vim ca-certificates fontconfig gzip tar less hostname procps-ng lsof nc && \
rpm -ivh https://repo.mysql.com/mysql80-community-release-el8-7.noarch.rpm && \
yum -y install mysql-community-client --nogpgcheck && \
yum remove -y mysql80-community-release
ENV JAVA_HOME=/usr/lib/jvm/java-11
RUN touch /.dockerenv
WORKDIR $STARROCKS_ROOT
# Run as starrocks user
ARG USER
ARG RUN_AS_USER
ARG GROUP=starrocks
RUN groupadd --gid 1000 $GROUP && useradd --no-create-home --uid 1000 --gid 1000 \
--shell /usr/sbin/nologin $USER && \
chown -R $USER:$GROUP $STARROCKS_ROOT
USER $USER
# Copy all artifacts to the runtime container image
COPY --from=artifacts --chown=$USER:$GROUP /release/fe_artifacts/ $STARROCKS_ROOT/
# Copy fe k8s scripts to the runtime container image
COPY --chown=$USER:$GROUP docker/dockerfiles/fe/*.sh $STARROCKS_ROOT/
# Create directory for FE metadata
RUN mkdir -p $STARROCKS_ROOT/fe/meta
# run as root by default
USER $RUN_AS_USER