# syntax=docker.io/docker/dockerfile:1 # HereDoc (EOF) feature (avoids needing `&& \`) requires BuildKit: # https://docs.docker.com/engine/reference/builder/#here-documents ARG LEAP_VERSION=15.4 ARG CACHE_ZYPPER=/tmp/cache/zypper ARG INSTALL_ROOT=/rootfs FROM opensuse/leap:${LEAP_VERSION} as builder ARG CACHE_ZYPPER ARG INSTALL_ROOT # --mount is only necessary for persisting the zypper cache on the build host, # Paired with --cache-dir below, RUN layer invalidation does not clear this cache. # Not useful for CI, only local builds that retain the storage. RUN --mount=type=cache,target="${CACHE_ZYPPER}",sharing=locked <> /etc/passwd echo 'testssl:x:1000:' >> /etc/group echo 'testssl:!::0:::::' >> /etc/shadow # Create user home with SGID set: install --mode 2755 --owner testssl --group testssl --directory /home/testssl # Add relative symlink to point to content that will COPY later: ln -sr /home/testssl/testssl.sh /usr/local/bin/ EOF USER testssl WORKDIR /home/testssl/ # Copy over build context (after filtered by .dockerignore): bin/ etc/ testssl.sh COPY --chown=testssl:testssl . /home/testssl/ ENTRYPOINT ["testssl.sh"] CMD ["--help"]