File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 1
1
ARG PYTHON_VERSION=3.8
2
2
FROM python:${PYTHON_VERSION}
3
3
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
+
17
+ COPY --chown=$BUILDER_USER:$BUILDER_GROUP . .
18
+
19
+ USER ${BUILDER_USER}:${BUILDER_GROUP}
4
20
WORKDIR /code/elasticsearch-py
5
21
COPY dev-requirements.txt .
6
22
RUN python -m pip install \
Original file line number Diff line number Diff line change 115
115
echo -e " \033[34;1mINFO: building $product container\033[0m"
116
116
117
117
docker build \
118
+ --build-arg BUILDER_UID=" $( id -u) " \
118
119
--file $repo /.ci/Dockerfile \
119
120
--tag ${product} \
120
121
.
@@ -129,6 +130,7 @@ if [[ "$CMD" == "assemble" ]]; then
129
130
130
131
# Build dists into .ci/output
131
132
docker run \
133
+ -u " $( id -u) " \
132
134
--rm -v $repo /.ci/output:/code/elasticsearch-py/dist \
133
135
$product \
134
136
/bin/bash -c " python /code/elasticsearch-py/utils/build-dists.py $VERSION "
You can’t perform that action at this time.
0 commit comments