Example #1
0
    def test_multistage_as_override_docker(self):
        """Multistage naming"""
        s0 = Stage()
        s0 += baseimage(image='centos:7', _as='devel')
        s0 += boost()
        s1 = Stage()
        s1 += s0.runtime(_from='build')
        self.assertEqual(
            str(s1), r'''# Boost
COPY --from=build /usr/local/boost /usr/local/boost
ENV LD_LIBRARY_PATH=/usr/local/boost/lib:$LD_LIBRARY_PATH''')
Example #2
0
    def test_multistage_noas_docker(self):
        """Multistage naming"""
        s0 = Stage()
        s0 += baseimage(image='centos:7')
        s0 += boost()
        s1 = Stage()
        s1 += s0.runtime()
        self.assertEqual(
            str(s1), r'''# Boost
COPY --from=0 /usr/local/boost /usr/local/boost
ENV LD_LIBRARY_PATH=/usr/local/boost/lib:$LD_LIBRARY_PATH''')
Example #3
0
    def test_runtime_exclude(self):
        """Runtime from a previous stage with exclude"""
        s0 = Stage()
        s0 += gnu()
        s0 += boost()
        s1 = Stage()
        s1 += s0.runtime(exclude=['boost'])
        self.assertEqual(
            str(s1), r'''# GNU compiler runtime
RUN yum install -y \
        libgomp \
        libgfortran && \
    rm -rf /var/cache/yum/*''')
Example #4
0
    def test_runtime(self):
        """Runtime from a previous stage"""
        s0 = Stage()
        s0 += gnu()
        s0 += shell(commands=['gcc -o hello hello.c'])
        s1 = Stage()
        s1 += s0.runtime()
        self.assertEqual(
            str(s1), r'''# GNU compiler runtime
RUN yum install -y \
        libgomp \
        libgfortran && \
    rm -rf /var/cache/yum/*''')
Example #5
0
    def test_multistage_as_override_singularity(self):
        """Multistage naming"""
        s0 = Stage()
        s0 += baseimage(image='centos:7', _as='devel')
        s0 += boost()
        s1 = Stage()
        s1 += s0.runtime(_from='build')
        self.assertEqual(
            str(s1), r'''# Boost
%files from build
    /usr/local/boost /usr/local/boost
%environment
    export LD_LIBRARY_PATH=/usr/local/boost/lib:$LD_LIBRARY_PATH
%post
    export LD_LIBRARY_PATH=/usr/local/boost/lib:$LD_LIBRARY_PATH''')