1 ## Create Dockerfile that builds container suitable for systemd build
2 ## This container runs as non-root user by deafult
4 # Use the latest stable version of fedora
7 # Demand the specification of non-root username
12 # Copy the requirements into the container at /tmp
13 COPY requirements.txt /tmp/
15 # Install the requirements
16 # RUN dnf -y update FIXME
17 RUN dnf -y install $(cat '/tmp/requirements.txt')
18 # clean step to prevent cache and metadata corruption
20 RUN dnf -y builddep systemd
22 # Add non-root user and chown the project dir
23 RUN groupadd -g $DOCKER_USER_GID $DOCKER_USER
24 RUN useradd --create-home --shell /bin/bash -u $DOCKER_USER_UID -g $DOCKER_USER_GID -G wheel $DOCKER_USER
25 ENV HOME /home/$DOCKER_USER
26 ENV PROJECTDIR $HOME/systemd
28 # Copy content to the project directory
31 # Greant user all permissions to the project dir
32 RUN chown -R $DOCKER_USER $PROJECTDIR
34 # Switch to noroot user by default
37 # Update workdir to user home dir