1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
# Docker >= 17.05.0-ce allows using build-time args (ARG) in FROM (#31352).
# https://github.com/moby/moby/releases/tag/v17.05.0-ce
ARG BASE_IMAGE=centos
FROM ${BASE_IMAGE}
# Test with non-root user.
ENV TEST_USER tester
ENV WORK_DIR "/work"
RUN uname -a
RUN yum -y update
RUN yum -y install epel-release
RUN yum -y install \
--setopt=deltarpm=0 \
--setopt=install_weak_deps=false \
--setopt=tsflags=nodocs \
file \
gcc \
git \
make \
redhat-rpm-config \
sudo \
automake autoconf libtool perl-Text-Diff pkgconf-pkg-config
# Create test user and the environment
RUN useradd "${TEST_USER}"
WORKDIR "${WORK_DIR}"
COPY . .
RUN chown -R "${TEST_USER}:${TEST_USER}" "${WORK_DIR}"
# Enable sudo without password for convenience.
RUN echo "${TEST_USER} ALL = NOPASSWD: ALL" >> /etc/sudoers
USER "${TEST_USER}"
|