Skip to content

Commit 67e23b5

Browse files
author
Renaud Gaubert
committed
Build the binary as the default docker root user
Signed-off-by: Renaud Gaubert <[email protected]>
1 parent ae23952 commit 67e23b5

File tree

6 files changed

+20
-50
lines changed

6 files changed

+20
-50
lines changed

mk/Dockerfile.amazonlinux

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ RUN if [ "$WITH_LIBELF" = "no" ]; then \
3434
rm -rf $PWD \
3535
; fi
3636

37-
ARG USERSPEC=0:0
38-
3937
WORKDIR /tmp/libnvidia-container
4038
COPY . .
41-
RUN chown -R $USERSPEC $PWD
42-
USER $USERSPEC
4339

4440
RUN make distclean && make -j"$(nproc)"
4541

mk/Dockerfile.centos

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ RUN if [ "$WITH_LIBELF" = "no" ]; then \
3434
rm -rf $PWD \
3535
; fi
3636

37-
ARG USERSPEC=0:0
38-
3937
WORKDIR /tmp/libnvidia-container
4038
COPY . .
41-
RUN chown -R $USERSPEC $PWD
42-
USER $USERSPEC
4339

4440
RUN make distclean && make -j"$(nproc)"
4541

mk/Dockerfile.debian

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2525

2626
ENV GPG_TTY /dev/console
2727

28-
ARG USERSPEC=0:0
29-
3028
WORKDIR /tmp/libnvidia-container
3129
COPY . .
32-
RUN chown -R $USERSPEC $PWD
33-
USER $USERSPEC
3430

3531
ARG WITH_LIBELF=no
3632
ARG WITH_TIRPC=no

mk/Dockerfile.opensuse-leap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,8 @@ ENV WITH_LIBELF=${WITH_LIBELF}
2828
ENV WITH_TIRPC=${WITH_TIRPC}
2929
ENV WITH_SECCOMP=${WITH_SECCOMP}
3030

31-
ARG USERSPEC=0:0
32-
3331
WORKDIR /tmp/libnvidia-container
3432
COPY . .
35-
RUN chown -R $USERSPEC $PWD /mnt
36-
USER $USERSPEC
3733

3834
# META_NOECHO=echo is required to work around a bug in Leap 15's version of bmake,
3935
# see also https://github.com/ptt/pttbbs/issues/30

mk/Dockerfile.ubuntu

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2424

2525
ENV GPG_TTY /dev/console
2626

27-
ARG USERSPEC=0:0
28-
2927
WORKDIR /tmp/libnvidia-container
3028
COPY . .
31-
RUN chown -R $USERSPEC $PWD
32-
USER $USERSPEC
3329

3430
ARG WITH_LIBELF=no
3531
ARG WITH_TIRPC=no

mk/docker.mk

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,71 +17,61 @@ docker: ubuntu18.04 ubuntu16.04 debian10 debian9 centos7 amzn2 amzn1 opensuse-le
1717

1818
ubuntu%: SHELL:=/bin/bash
1919
ubuntu%:
20-
$(DOCKER) build --network=host \
21-
--build-arg VERSION_ID=$* \
22-
--build-arg USERSPEC=$(UID):$(GID) \
20+
$(DOCKER) build --build-arg VERSION_ID=$* \
2321
--build-arg WITH_LIBELF=$(WITH_LIBELF) \
2422
--build-arg WITH_TIRPC=$(WITH_TIRPC) \
2523
--build-arg WITH_SECCOMP=$(WITH_SECCOMP) \
2624
-t nvidia/$(LIB_NAME)/ubuntu:$* -f $(MAKE_DIR)/Dockerfile.ubuntu .
2725
$(MKDIR) -p $(DIST_DIR)/ubuntu$*/$(ARCH)
28-
$(DOCKER) run --cidfile $*.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/ubuntu:$*
29-
$(DOCKER) cp $$(cat $*.cid):/mnt/. $(DIST_DIR)/ubuntu$*/$(ARCH)
30-
$(DOCKER) rm $$(cat $*.cid) && rm $*.cid
26+
$(DOCKER) run --cidfile $@.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/ubuntu:$*
27+
$(DOCKER) cp $$(cat $@.cid):/mnt/. $(DIST_DIR)/ubuntu$*/$(ARCH)
28+
$(DOCKER) rm $$(cat $@.cid) && rm $@.cid
3129

3230
debian%: SHELL:=/bin/bash
3331
debian%:
34-
$(DOCKER) build --network=host \
35-
--build-arg VERSION_ID=$* \
36-
--build-arg USERSPEC=$(UID):$(GID) \
32+
$(DOCKER) build --build-arg VERSION_ID=$* \
3733
--build-arg WITH_LIBELF=$(WITH_LIBELF) \
3834
--build-arg WITH_TIRPC=$(WITH_TIRPC) \
3935
--build-arg WITH_SECCOMP=$(WITH_SECCOMP) \
4036
-t nvidia/$(LIB_NAME)/debian:$* -f $(MAKE_DIR)/Dockerfile.debian .
4137
$(MKDIR) -p $(DIST_DIR)/debian$*/$(ARCH)
42-
$(DOCKER) run --cidfile $*.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/debian:$*
43-
$(DOCKER) cp $$(cat $*.cid):/mnt/. $(DIST_DIR)/debian$*/$(ARCH)
44-
$(DOCKER) rm $$(cat $*.cid) && rm $*.cid
38+
$(DOCKER) run --cidfile $@.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/debian:$*
39+
$(DOCKER) cp $$(cat $@.cid):/mnt/. $(DIST_DIR)/debian$*/$(ARCH)
40+
$(DOCKER) rm $$(cat $@.cid) && rm $@.cid
4541

4642
centos%: SHELL:=/bin/bash
4743
centos%:
48-
$(DOCKER) build --network=host \
49-
--build-arg VERSION_ID=$* \
50-
--build-arg USERSPEC=$(UID):$(GID) \
44+
$(DOCKER) build --build-arg VERSION_ID=$* \
5145
--build-arg WITH_LIBELF=$(WITH_LIBELF) \
5246
--build-arg WITH_TIRPC=$(WITH_TIRPC) \
5347
--build-arg WITH_SECCOMP=$(WITH_SECCOMP) \
5448
-t nvidia/$(LIB_NAME)/centos:$* -f $(MAKE_DIR)/Dockerfile.centos .
5549
$(MKDIR) -p $(DIST_DIR)/centos$*/$(ARCH)
56-
$(DOCKER) run --cidfile $*.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/centos:$*
57-
$(DOCKER) cp $$(cat $*.cid):/mnt/. $(DIST_DIR)/centos$*/$(ARCH)
58-
$(DOCKER) rm $$(cat $*.cid) && rm $*.cid
50+
$(DOCKER) run --cidfile $@.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/centos:$*
51+
$(DOCKER) cp $$(cat $@.cid):/mnt/. $(DIST_DIR)/centos$*/$(ARCH)
52+
$(DOCKER) rm $$(cat $@.cid) && rm $@.cid
5953

6054
amazonlinux%: SHELL:=/bin/bash
6155
amazonlinux%:
62-
$(DOCKER) build --network=host \
63-
--build-arg VERSION_ID=$* \
64-
--build-arg USERSPEC=$(UID):$(GID) \
56+
$(DOCKER) build --build-arg VERSION_ID=$* \
6557
--build-arg WITH_LIBELF=$(WITH_LIBELF) \
6658
--build-arg WITH_TIRPC=$(WITH_TIRPC) \
6759
--build-arg WITH_SECCOMP=$(WITH_SECCOMP) \
6860
-t nvidia/$(LIB_NAME)/amazonlinux:$* -f $(MAKE_DIR)/Dockerfile.amazonlinux .
6961
$(MKDIR) -p $(DIST_DIR)/amazonlinux$*/$(ARCH)
70-
$(DOCKER) run --cidfile $*.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/amazonlinux:$*
71-
$(DOCKER) cp $$(cat $*.cid):/mnt/. $(DIST_DIR)/amazonlinux$*/$(ARCH)
72-
$(DOCKER) rm $$(cat $*.cid) && rm $*.cid
62+
$(DOCKER) run --cidfile $@.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/amazonlinux:$*
63+
$(DOCKER) cp $$(cat $@.cid):/mnt/. $(DIST_DIR)/amazonlinux$*/$(ARCH)
64+
$(DOCKER) rm $$(cat $@.cid) && rm $@.cid
7365

7466

7567
opensuse-leap%: SHELL:=/bin/bash
7668
opensuse-leap%:
77-
$(DOCKER) build --network=host \
78-
--build-arg VERSION_ID=$* \
79-
--build-arg USERSPEC=$(UID):$(GID) \
69+
$(DOCKER) build --build-arg VERSION_ID=$* \
8070
--build-arg WITH_LIBELF=$(WITH_LIBELF) \
8171
--build-arg WITH_TIRPC=$(WITH_TIRPC) \
8272
--build-arg WITH_SECCOMP=$(WITH_SECCOMP) \
8373
-t nvidia/$(LIB_NAME)/opensuse-leap:$* -f $(MAKE_DIR)/Dockerfile.opensuse-leap .
8474
$(MKDIR) -p $(DIST_DIR)/opensuse-leap$*/$(ARCH)
85-
$(DOCKER) run --cidfile $*.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/opensuse-leap:$*
86-
$(DOCKER) cp $$(cat $*.cid):/mnt/. $(DIST_DIR)/opensuse-leap$*/$(ARCH)
87-
$(DOCKER) rm $$(cat $*.cid) && rm $*.cid
75+
$(DOCKER) run --cidfile $@.cid -e DISTRIB -e SECTION nvidia/$(LIB_NAME)/opensuse-leap:$*
76+
$(DOCKER) cp $$(cat $@.cid):/mnt/. $(DIST_DIR)/opensuse-leap$*/$(ARCH)
77+
$(DOCKER) rm $$(cat $@.cid) && rm $@.cid

0 commit comments

Comments
 (0)