]> git.ipfire.org Git - thirdparty/systemd.git/blame - travis-ci/Dockerfile
Merge pull request #12807 from keszybz/net-naming-scheme-yet-again
[thirdparty/systemd.git] / travis-ci / Dockerfile
CommitLineData
99127d20 1## Create Dockerfile that builds container suitable for systemd build
5238e957 2## This container runs as non-root user by default
99127d20 3
d5a650d2 4FROM fedora:27
99127d20
5
6# Demand the specification of non-root username
7ARG DOCKER_USER
8ARG DOCKER_USER_UID
9ARG DOCKER_USER_GID
10
11# Copy the requirements into the container at /tmp
12COPY requirements.txt /tmp/
13
14# Install the requirements
15# RUN dnf -y update FIXME
16RUN dnf -y install $(cat '/tmp/requirements.txt')
17# clean step to prevent cache and metadata corruption
18RUN dnf clean all
19RUN dnf -y builddep systemd
20
21# Add non-root user and chown the project dir
22RUN groupadd -g $DOCKER_USER_GID $DOCKER_USER
23RUN useradd --create-home --shell /bin/bash -u $DOCKER_USER_UID -g $DOCKER_USER_GID -G wheel $DOCKER_USER
24ENV HOME /home/$DOCKER_USER
25ENV PROJECTDIR $HOME/systemd
26
27# Copy content to the project directory
28COPY . $PROJECTDIR
29
30# Greant user all permissions to the project dir
31RUN chown -R $DOCKER_USER $PROJECTDIR
32
33# Switch to noroot user by default
34USER $DOCKER_USER
35
36# Update workdir to user home dir
37WORKDIR $PROJECTDIR