shellspec/shellspec

View on GitHub
.dockerhub/Dockerfile.debian

Summary

Maintainability
Test Coverage
# Build two images with Automated Builds using Docker Hub hooks.
#   See https://github.com/shellspec/shellspec/tree/master/.dockerhub/hooks

# ======================================================================
# source code
# ======================================================================
FROM scratch as source
COPY shellspec LICENSE /opt/shellspec/
COPY lib /opt/shellspec/lib
COPY libexec /opt/shellspec/libexec

# ======================================================================
# Kcov builder
# ======================================================================
FROM debian:10 AS builder
ENV KCOV=v38 DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes
WORKDIR /usr/local/src
RUN apt-get update && apt-get install -y \
      build-essential cmake ninja-build python3 wget \
      binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
RUN wget -q https://github.com/SimonKagstrom/kcov/archive/$KCOV.tar.gz
RUN tar xzf $KCOV.tar.gz -C ./ --strip-components 1
RUN mkdir build && cd build \
 && cmake -G Ninja .. && cmake --build . --target install

# ======================================================================
# Kcov image
#   TAG: shellspec-debian:kcov, shellspec-debian:[VERSION]-kcov
# ======================================================================
FROM debian:10 as kcov
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes \
 && apt-get update && apt-get install -y binutils libcurl4 zlib1g libdw1 \
 && apt-get clean && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/kcov* /usr/local/bin/
COPY --from=builder /usr/local/share/doc/kcov /usr/local/share/doc/kcov
COPY --from=source /opt/shellspec /opt/shellspec
COPY .dockerhub/shellspec-docker-entrypoint.sh /shellspec-docker
ENV PATH /opt/shellspec/:$PATH
WORKDIR /src
ENTRYPOINT [ "shellspec" ]
ARG CREATED
ARG AUTHORS
ARG VERSION
ARG REVISION
ARG REFNAME
LABEL org.opencontainers.image.created=$CREATED \
      org.opencontainers.image.authors=$AUTHORS \
      org.opencontainers.image.url="https://shellspec.info/" \
      org.opencontainers.image.documentation="https://github.com/shellspec/shellspec" \
      org.opencontainers.image.source="https://github.com/shellspec/shellspec.git" \
      org.opencontainers.image.version=$VERSION \
      org.opencontainers.image.revision=$REVISION \
      org.opencontainers.image.vendor="shellspec" \
      org.opencontainers.image.licenses="MIT" \
      org.opencontainers.image.ref.name=$REFNAME \
      org.opencontainers.image.title="shellspec-debian+kcov" \
      org.opencontainers.image.description="Shellspec (Debian based with Kcov)"

# ======================================================================
# Standard image (default)
#   TAG: shellspec-debian:latest, shellspec-debian:[VERSION]
# ======================================================================
FROM debian:10 as standard
COPY --from=source /opt/shellspec /opt/shellspec
COPY .dockerhub/shellspec-docker-entrypoint.sh /shellspec-docker
ENV PATH /opt/shellspec/:$PATH
WORKDIR /src
ENTRYPOINT [ "shellspec" ]
ARG CREATED
ARG AUTHORS
ARG VERSION
ARG REVISION
ARG REFNAME
LABEL org.opencontainers.image.created=$CREATED \
      org.opencontainers.image.authors=$AUTHORS \
      org.opencontainers.image.url="https://shellspec.info/" \
      org.opencontainers.image.documentation="https://github.com/shellspec/shellspec" \
      org.opencontainers.image.source="https://github.com/shellspec/shellspec.git" \
      org.opencontainers.image.version=$VERSION \
      org.opencontainers.image.revision=$REVISION \
      org.opencontainers.image.vendor="shellspec" \
      org.opencontainers.image.licenses="MIT" \
      org.opencontainers.image.ref.name=$REFNAME \
      org.opencontainers.image.title="shellspec-debian" \
      org.opencontainers.image.description="Shellspec (Debian based)"