1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
systemd/travis-ci/Dockerfile
Evegeny Vereshchagin d5a650d2c3 travis: use Fedora 27 as a base image
It was confirmed experimentally that Fedora 27 is more suitable
for running cov-build than Fedora 28:
https://github.com/systemd/systemd/issues/9186#issuecomment-394577877.
2018-06-05 12:03:18 +03:00

38 lines
1.0 KiB
Docker

## 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