@@ -14,3 +14,8 @@ PIP3='/usr/local/bin/pip-3.8'
PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 zstd'
PYPI_PKGS=''
PYTHON='/usr/local/bin/python3'
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -14,3 +14,8 @@ PIP3='/usr/local/bin/pip-3.8'
PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 zstd'
PYPI_PKGS=''
PYTHON='/usr/local/bin/python3'
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -14,3 +14,8 @@ PIP3='/opt/homebrew/bin/pip3'
PKGS='bash bc bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 jemalloc jpeg-turbo json-c libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson ncurses nettle ninja pixman pkg-config python3 rpm2cpio sdl2 sdl2_image snappy socat sparse spice-protocol tesseract usbredir vde vte3 zlib zstd'
PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme'
PYTHON='/opt/homebrew/bin/python3'
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -124,3 +124,8 @@ ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -134,3 +134,8 @@ ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -169,3 +169,8 @@ ENV ABI "x86_64-linux-gnu"
ENV MESON_OPTS "--cross-file=x86_64-linux-gnu"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=x86_64-linux-gnu-
ENV DEF_TARGET_LIST x86_64-softmmu,x86_64-linux-user,i386-softmmu,i386-linux-user
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -155,3 +155,8 @@ RUN git clone https://github.com/luigirizzo/netmap.git /usr/src/netmap
RUN cd /usr/src/netmap && git checkout v11.3
RUN cd /usr/src/netmap/LINUX && ./configure --no-drivers --no-apps --kernel-dir=$(ls -d /usr/src/linux-headers-*-amd64) && make install
ENV QEMU_CONFIGURE_OPTS --enable-netmap
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -168,3 +168,8 @@ ENV ABI "aarch64-linux-gnu"
ENV MESON_OPTS "--cross-file=aarch64-linux-gnu"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=aarch64-linux-gnu-
ENV DEF_TARGET_LIST aarch64-softmmu,aarch64-linux-user
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -167,3 +167,8 @@ ENV ABI "arm-linux-gnueabi"
ENV MESON_OPTS "--cross-file=arm-linux-gnueabi"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=arm-linux-gnueabi-
ENV DEF_TARGET_LIST arm-softmmu,arm-linux-user,armeb-linux-user
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -168,3 +168,8 @@ ENV ABI "arm-linux-gnueabihf"
ENV MESON_OPTS "--cross-file=arm-linux-gnueabihf"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=arm-linux-gnueabihf-
ENV DEF_TARGET_LIST arm-softmmu,arm-linux-user
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -165,3 +165,8 @@ ENV ABI "mips64el-linux-gnuabi64"
ENV MESON_OPTS "--cross-file=mips64el-linux-gnuabi64"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=mips64el-linux-gnuabi64-
ENV DEF_TARGET_LIST mips64el-softmmu,mips64el-linux-user
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -165,3 +165,8 @@ ENV ABI "mipsel-linux-gnu"
ENV MESON_OPTS "--cross-file=mipsel-linux-gnu"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=mipsel-linux-gnu-
ENV DEF_TARGET_LIST mipsel-softmmu,mipsel-linux-user
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -167,3 +167,8 @@ ENV ABI "powerpc64le-linux-gnu"
ENV MESON_OPTS "--cross-file=powerpc64le-linux-gnu"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=powerpc64le-linux-gnu-
ENV DEF_TARGET_LIST ppc64-softmmu,ppc64-linux-user
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -166,3 +166,8 @@ ENV ABI "s390x-linux-gnu"
ENV MESON_OPTS "--cross-file=s390x-linux-gnu"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=s390x-linux-gnu-
ENV DEF_TARGET_LIST s390x-softmmu,s390x-linux-user
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -100,3 +100,8 @@ ENV ABI "i686-w64-mingw32"
ENV MESON_OPTS "--cross-file=/usr/share/mingw/toolchain-mingw32.meson"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=i686-w64-mingw32-
ENV DEF_TARGET_LIST i386-softmmu
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -100,3 +100,8 @@ ENV ABI "x86_64-w64-mingw32"
ENV MESON_OPTS "--cross-file=/usr/share/mingw/toolchain-mingw64.meson"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=x86_64-w64-mingw32-
ENV DEF_TARGET_LIST x86_64-softmmu
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -146,3 +146,8 @@ ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -137,3 +137,8 @@ ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -146,3 +146,8 @@ ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -145,3 +145,8 @@ ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+ id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
\ No newline at end of file
@@ -40,6 +40,15 @@ def atomic_write(filename, content):
tmp.unlink()
raise
+# Optional user setting, this will always be the last thing added
+# so maximise the number of layers that are cached
+add_user_mapping = [
+ "# As a final step configure the user (if env is defined)",
+ "ARG USER",
+ "ARG UID",
+ "RUN if [ \"${USER}\" ]; then \\",
+ " id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi"
+]
def generate(filename, cmd, trailer):
print("Generate %s" % filename)
@@ -51,9 +60,9 @@ def generate(filename, cmd, trailer):
content = lcitool.stdout.decode("utf8")
if trailer is not None:
content += trailer
+ content += "\n".join(add_user_mapping)
atomic_write(filename, content)
-
def generate_dockerfile(host, target, cross=None, trailer=None):
filename = Path(src_dir, "tests", "docker", "dockerfiles", host + ".docker")
cmd = lcitool_cmd + ["dockerfile"]
For the cross-compilation use-case it is important to add the host user to the dockerfile so we can map them to the docker environment when cross-building files. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- .gitlab-ci.d/cirrus/freebsd-12.vars | 5 +++++ .gitlab-ci.d/cirrus/freebsd-13.vars | 5 +++++ .gitlab-ci.d/cirrus/macos-12.vars | 5 +++++ tests/docker/dockerfiles/alpine.docker | 5 +++++ tests/docker/dockerfiles/centos8.docker | 5 +++++ tests/docker/dockerfiles/debian-amd64-cross.docker | 5 +++++ tests/docker/dockerfiles/debian-amd64.docker | 5 +++++ tests/docker/dockerfiles/debian-arm64-cross.docker | 5 +++++ tests/docker/dockerfiles/debian-armel-cross.docker | 5 +++++ tests/docker/dockerfiles/debian-armhf-cross.docker | 5 +++++ tests/docker/dockerfiles/debian-mips64el-cross.docker | 5 +++++ tests/docker/dockerfiles/debian-mipsel-cross.docker | 5 +++++ tests/docker/dockerfiles/debian-ppc64el-cross.docker | 5 +++++ tests/docker/dockerfiles/debian-s390x-cross.docker | 5 +++++ tests/docker/dockerfiles/fedora-win32-cross.docker | 5 +++++ tests/docker/dockerfiles/fedora-win64-cross.docker | 5 +++++ tests/docker/dockerfiles/fedora.docker | 5 +++++ tests/docker/dockerfiles/opensuse-leap.docker | 5 +++++ tests/docker/dockerfiles/ubuntu2004.docker | 5 +++++ tests/docker/dockerfiles/ubuntu2204.docker | 5 +++++ tests/lcitool/refresh | 11 ++++++++++- 21 files changed, 110 insertions(+), 1 deletion(-)