Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docker/InstallTarballPackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh

# Exit on errors
set -e

#
# Example use:
# ./InstallTarballPackage.sh "6.0.0-beta.8" "powershell-6.0.0-beta.8-linux-x64.tar.gz"
#
usage() {
echo "usage: $0 <powershell version> <powershell package name>"
exit 1
}

POWERSHELL_VERSION=$1
if [ ! "$POWERSHELL_VERSION" ]
then
usage
fi

POWERSHELL_PACKAGE=$2
if [ ! "$POWERSHELL_PACKAGE" ]
then
usage
fi

POWERSHELL_LINKFILE=/usr/bin/powershell

# Download the powershell .tar.gz package
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v$POWERSHELL_VERSION/$POWERSHELL_PACKAGE

# Create the target folder where powershell will be placed
mkdir -p /opt/microsoft/powershell/$POWERSHELL_VERSION
# Expand powershell to the target folder
tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/$POWERSHELL_VERSION

# Create the symbolic link that points to powershell
ln -s /opt/microsoft/powershell/$POWERSHELL_VERSION/powershell $POWERSHELL_LINKFILE
# Add the symbolic link path to /etc/shells
if [ ! -f /etc/shells ] ; then
echo $POWERSHELL_LINKFILE > /etc/shells ;
else
grep -q "^${POWERSHELL_LINKFILE}$" /etc/shells || echo $POWERSHELL_LINKFILE >> /etc/shells ;
fi
55 changes: 55 additions & 0 deletions docker/community/amazonlinux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Docker image file that describes an Amazon Linux image with PowerShell installed from PowerShell Release

FROM amazonlinux:latest

ARG POWERSHELL_VERSION=6.0.0-beta.8
ARG POWERSHELL_PACKAGE=powershell-6.0.0-beta.8-linux-x64.tar.gz
ARG IMAGE_NAME=microsoft/powershell:amazonlinux

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} powershell -c '$psversiontable'" \
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} powershell -c Invoke-Pester" \
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} powershell -c Get-Help"

# TODO: addd LABEL org.label-schema.vcs-ref=${VCS_REF}

# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG

# Install dependencies and clean up
RUN yum install -y \
curl \
libunwind \
libicu \
libcurl \
openssl \
libuuid.x86_64 \
&& yum clean all

# Get the InstallTarballPackage.sh script
ADD https://raw.githubusercontent.com/PowerShell/PowerShell/master/docker/InstallTarballPackage.sh /InstallTarballPackage.sh

# Add execution permission
RUN chmod +x /InstallTarballPackage.sh

# Install powershell from tarball package
RUN /InstallTarballPackage.sh $POWERSHELL_VERSION $POWERSHELL_PACKAGE

# Remove the script
RUN rm -f /InstallTarballPackage.sh

# Use PowerShell as the default shell
# Use array to avoid Docker prepending /bin/sh -c
CMD [ "powershell" ]
81 changes: 0 additions & 81 deletions docker/release/fedora24/Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Docker image file that describes an Centos7 image with PowerShell installed from Microsoft YUM Repo
# Docker image file that describes an fedora 25 image with PowerShell installed from Microsoft YUM Repo

FROM amazonlinux:latest
FROM fedora:25

ARG POWERSHELL_VERSION=6.0.0-beta.8
ARG IMAGE_NAME=microsoft/powershell:amazonlinux
ARG IMAGE_NAME=microsoft/powershell:fedora25

LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md" \
Expand All @@ -22,24 +22,22 @@ LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \

# TODO: addd LABEL org.label-schema.vcs-ref=${VCS_REF}

# Install dependencies and clean up
RUN dnf install -y \
curl \
glibc-locale-source \
&& 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

# Install dependencies and clean up
RUN yum install -y \
curl \
libuuid.x86_64 \
&& yum clean all

# Download and configure Microsoft Repository config file
RUN 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 yum install -y \
powershell
RUN dnf install -y powershell

# Use PowerShell as the default shell
# Use array to avoid Docker prepending /bin/sh -c
CMD [ "powershell" ]
43 changes: 43 additions & 0 deletions docker/release/fedora26/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Docker image file that describes an fedora 25 image with PowerShell installed from Microsoft YUM Repo

FROM fedora:26

ARG POWERSHELL_VERSION=6.0.0-beta.8
ARG IMAGE_NAME=microsoft/powershell:fedora26

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} powershell -c '$psversiontable'" \
org.label-schema.docker.cmd.devel="docker run ${IMAGE_NAME}" \
org.label-schema.docker.cmd.test="docker run ${IMAGE_NAME} powershell -c Invoke-Pester" \
org.label-schema.docker.cmd.help="docker run ${IMAGE_NAME} powershell -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 \
&& 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 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

# Use array to avoid Docker prepending /bin/sh -c
CMD [ "powershell" ]
27 changes: 20 additions & 7 deletions docker/release/opensuse42.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Docker image file that describes an OpenSUSE 42.1 (AKA leap 42.1) image with PowerShell installed from PowerShell Release
# Docker image file that describes an OpenSUSE 42.2 image with PowerShell installed from PowerShell Release

FROM opensuse:42.2

ARG POWERSHELL_VERSION=6.0.0_beta.8
ARG POWERSHELL_RELEASE=v6.0.0-beta.8
ARG FORK=PowerShell
ARG POWERSHELL_PACKAGE=powershell-6.0.0_beta.8-1.rhel.7.x86_64.rpm
ARG POWERSHELL_VERSION=6.0.0-beta.8
ARG POWERSHELL_PACKAGE=powershell-6.0.0-beta.8-linux-x64.tar.gz
ARG IMAGE_NAME=microsoft/powershell:opensuse42.2

LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>" \
Expand All @@ -31,14 +30,28 @@ RUN zypper --non-interactive update --skip-interactive \
&& zypper --non-interactive install \
glibc-locale \
glibc-i18ndata \
tar \
curl \
&& rpm --import https://packages.microsoft.com/keys/microsoft.asc \
&& zypper --non-interactive install https://github.com/$FORK/PowerShell/releases/download/$POWERSHELL_RELEASE/$POWERSHELL_PACKAGE \
libunwind \
libicu \
openssl \
&& zypper --non-interactive clean --all

# Setup the locale
ENV LANG en_US.UTF-8
ENV LC_ALL $LANG
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG

# Get the InstallTarballPackage.sh script
ADD https://raw.githubusercontent.com/PowerShell/PowerShell/master/docker/InstallTarballPackage.sh /InstallTarballPackage.sh

# Add execution permission
RUN chmod +x /InstallTarballPackage.sh

# Install powershell from tarball package
RUN /InstallTarballPackage.sh $POWERSHELL_VERSION $POWERSHELL_PACKAGE

# Remove the script
RUN rm -f /InstallTarballPackage.sh

CMD [ "powershell" ]