-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
non-root user to build artifacts inside the container
- Loading branch information
1 parent
576fae9
commit d411230
Showing
4 changed files
with
21 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
ARG PYTHON_VERSION=3.8 | ||
FROM python:${PYTHON_VERSION} | ||
|
||
# Default UID/GID to 1000 | ||
# it can be overridden at build time | ||
ARG BUILDER_UID=1000 | ||
ARG BUILDER_GID=1000 | ||
ENV BUILDER_USER elastic | ||
ENV BUILDER_GROUP elastic | ||
|
||
# Create user | ||
RUN groupadd --system -g ${BUILDER_GID} ${BUILDER_GROUP} \ | ||
&& useradd --system --shell /bin/bash -u ${BUILDER_UID} -g ${BUILDER_GROUP} -d /var/lib/elastic -m elastic 1>/dev/null 2>/dev/null \ | ||
&& mkdir -p /code/elasticsearch-py && mkdir /code/elasticsearch-py/build \ | ||
&& chown -R ${BUILDER_USER}:${BUILDER_GROUP} /code/elasticsearch-py | ||
COPY --chown=$BUILDER_USER:$BUILDER_GROUP . . | ||
WORKDIR /code/elasticsearch-py | ||
USER ${BUILDER_USER}:${BUILDER_GROUP} | ||
COPY dev-requirements.txt . | ||
RUN python -m pip install \ | ||
-U --no-cache-dir \ | ||
--disable-pip-version-check \ | ||
pip \ | ||
&& python -m pip install \ | ||
--no-cache-dir \ | ||
--disable-pip-version-check \ | ||
-r dev-requirements.txt | ||
|
||
COPY . . | ||
RUN python -m pip install -e . | ||
nox -rdev-requirements.txt | ||
COPY --chown=$BUILDER_USER:$BUILDER_GROUP . . | ||
RUN python -m pip install -U -e . |
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