File tree Expand file tree Collapse file tree 4 files changed +21
-8
lines changed
Expand file tree Collapse file tree 4 files changed +21
-8
lines changed Original file line number Diff line number Diff line change 11ARG PYTHON_VERSION=3.8
22FROM python:${PYTHON_VERSION}
33
4+ # Default UID/GID to 1000
5+ # it can be overridden at build time
6+ ARG BUILDER_UID=1000
7+ ARG BUILDER_GID=1000
8+ ENV BUILDER_USER elastic
9+ ENV BUILDER_GROUP elastic
10+
11+ # Create user
12+ RUN groupadd --system -g ${BUILDER_GID} ${BUILDER_GROUP} \
13+ && useradd --system --shell /bin/bash -u ${BUILDER_UID} -g ${BUILDER_GROUP} -d /var/lib/elastic -m elastic 1>/dev/null 2>/dev/null \
14+ && mkdir -p /code/elasticsearch-py && mkdir /code/elasticsearch-py/build \
15+ && chown -R ${BUILDER_USER}:${BUILDER_GROUP} /code/elasticsearch-py
16+ COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
417WORKDIR /code/elasticsearch-py
18+ USER ${BUILDER_USER}:${BUILDER_GROUP}
519COPY dev-requirements.txt .
620RUN python -m pip install \
721 -U --no-cache-dir \
822 --disable-pip-version-check \
9- pip \
10- && python -m pip install \
11- --no-cache-dir \
12- --disable-pip-version-check \
13- -r dev-requirements.txt
14-
15- COPY . .
16- RUN python -m pip install -e .
23+ nox -rdev-requirements.txt
24+ COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
25+ RUN python -m pip install -U -e .
Original file line number Diff line number Diff line change 115115echo -e " \033[34;1mINFO: building $product container\033[0m"
116116
117117docker build \
118+ --build-arg BUILDER_UID=" $( id -u) " \
118119 --file $repo /.ci/Dockerfile \
119120 --tag ${product} \
120121 .
@@ -129,6 +130,7 @@ if [[ "$CMD" == "assemble" ]]; then
129130
130131 # Build dists into .ci/output
131132 docker run \
133+ -u " $( id -u) " \
132134 --rm -v $repo /.ci/output:/code/elasticsearch-py/dist \
133135 $product \
134136 /bin/bash -c " python /code/elasticsearch-py/utils/build-dists.py $VERSION "
Original file line number Diff line number Diff line change 116116 echo -e " \033[34;1mINFO:\033[0m Starting container $node_name \033[0m"
117117 set -x
118118 docker run \
119+ -u " $( id -u) " \
119120 --name " $node_name " \
120121 --network " $network_name " \
121122 --env " ES_JAVA_OPTS=-Xms1g -Xmx1g -da:org.elasticsearch.xpack.ccr.index.engine.FollowingEngineAssertions" \
Original file line number Diff line number Diff line change 3737
3838mkdir -p junit
3939docker run \
40+ -u " $( id -u) " \
4041 --network=${network_name} \
4142 --env " STACK_VERSION=${STACK_VERSION} " \
4243 --env " ELASTICSEARCH_URL=${elasticsearch_url} " \
You can’t perform that action at this time.
0 commit comments