Without the pipefail, the step always succeeds and the layer gets cached, resulting in confusion during the next step failing and subsequent rebuild attempt.
48 lines
2 KiB
Docker
48 lines
2 KiB
Docker
# Docker image file that describes an fedora 27 image with PowerShell installed from Microsoft YUM Repo
|
|
ARG FromTag=27
|
|
|
|
FROM fedora:${FromTag}
|
|
|
|
ARG POWERSHELL_VERSION=6.0.2
|
|
ARG IMAGE_NAME=microsoft/powershell:fedora27
|
|
|
|
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
|
|
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
|
|
description="This Dockerfile will install the latest release of PS." \
|
|
org.label-schema.usage="https://github.com/PowerShell/PowerShell/tree/master/docker#run-the-docker-image-you-built" \
|
|
org.label-schema.url="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
|
|
org.label-schema.vcs-url="https://github.com/PowerShell/PowerShell" \
|
|
org.label-schema.name="powershell" \
|
|
org.label-schema.vendor="PowerShell" \
|
|
org.label-schema.version=${POWERSHELL_VERSION} \
|
|
org.label-schema.schema-version="1.0" \
|
|
org.label-schema.docker.cmd="docker run ${IMAGE_NAME} pwsh -c '$psversiontable'" \
|
|
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
|
|
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} pwsh -c Invoke-Pester" \
|
|
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} pwsh -c Get-Help"
|
|
|
|
# TODO: addd LABEL org.label-schema.vcs-ref=${VCS_REF}
|
|
|
|
# Install dependencies and clean up
|
|
RUN dnf install -y \
|
|
curl \
|
|
glibc-locale-source \
|
|
compat-openssl10 \
|
|
&& dnf upgrade-minimal -y --security \
|
|
&& dnf clean all
|
|
|
|
# Setup the locale
|
|
ENV LANG en_US.UTF-8
|
|
ENV LC_ALL $LANG
|
|
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
|
|
|
# Download and configure Microsoft Repository config file
|
|
RUN set -o pipefail \
|
|
&& curl https://packages.microsoft.com/config/rhel/7/prod.repo | tee /etc/yum.repos.d/microsoft.repo
|
|
|
|
# Install latest powershell from Microsoft YUM Repo
|
|
RUN dnf install -y powershell-${POWERSHELL_VERSION} \
|
|
&& dnf clean all
|
|
|
|
# Use array to avoid Docker prepending /bin/sh -c
|
|
CMD [ "pwsh" ]
|