diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:25:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 02:25:50 +0000 |
commit | 19f4f86bfed21c5326ed2acebe1163f3a83e832b (patch) | |
tree | d59b9989ce55ed23693e80974d94c856f1c2c8b1 /travis-ci/Dockerfile | |
parent | Initial commit. (diff) | |
download | systemd-upstream.tar.xz systemd-upstream.zip |
Adding upstream version 241.upstream/241upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'travis-ci/Dockerfile')
-rw-r--r-- | travis-ci/Dockerfile | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/travis-ci/Dockerfile b/travis-ci/Dockerfile new file mode 100644 index 0000000..71dd07a --- /dev/null +++ b/travis-ci/Dockerfile @@ -0,0 +1,37 @@ +## Create Dockerfile that builds container suitable for systemd build +## This container runs as non-root user by deafult + +FROM fedora:27 + +# Demand the specification of non-root username +ARG DOCKER_USER +ARG DOCKER_USER_UID +ARG DOCKER_USER_GID + +# Copy the requirements into the container at /tmp +COPY requirements.txt /tmp/ + +# Install the requirements +# RUN dnf -y update FIXME +RUN dnf -y install $(cat '/tmp/requirements.txt') +# clean step to prevent cache and metadata corruption +RUN dnf clean all +RUN dnf -y builddep systemd + +# Add non-root user and chown the project dir +RUN groupadd -g $DOCKER_USER_GID $DOCKER_USER +RUN useradd --create-home --shell /bin/bash -u $DOCKER_USER_UID -g $DOCKER_USER_GID -G wheel $DOCKER_USER +ENV HOME /home/$DOCKER_USER +ENV PROJECTDIR $HOME/systemd + +# Copy content to the project directory +COPY . $PROJECTDIR + +# Greant user all permissions to the project dir +RUN chown -R $DOCKER_USER $PROJECTDIR + +# Switch to noroot user by default +USER $DOCKER_USER + +# Update workdir to user home dir +WORKDIR $PROJECTDIR |