Skip to content
Merged
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
19 changes: 12 additions & 7 deletions test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# syntax=docker/dockerfile:1
# Dockerfile to test the library with multiple versions of PowerShell >= 7.
#
# Example run (from repo root):
# > $version="7.1.5"; docker build -f .\test\docker\Dockerfile . -t powershell-featureflags-test:$version --build-arg VERSION=$version --build-arg UBUNTU_VERSION=18.04 && docker run powershell-featureflags-test:$version
# PS > $version="7.1.5"; docker build -f .\test\docker\Dockerfile . -t powershell-featureflags-test:$version --build-arg VERSION=$version --build-arg UBUNTU_VERSION=18.04 && docker run powershell-featureflags-test:$version

ARG VERSION=7.2.5
ARG UBUNTU_VERSION=16.04
Expand All @@ -11,16 +12,20 @@ FROM mcr.microsoft.com/powershell:${VERSION}-ubuntu-${UBUNTU_VERSION}
#
# Not using the dotnet SDK images because they bring their own powershell,
# see for example https://github.com/dotnet/dotnet-docker/blob/main/src/sdk/6.0/focal/amd64/Dockerfile.
# For some reason, docker images for Powershell 6 don't have curl.
ENV DOTNET_SDK_VERSION=6.0.301
RUN curl -fSL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz
RUN mkdir -p /usr/share/dotnet
RUN tar -oxzf dotnet.tar.gz -C /usr/share/dotnet
RUN rm dotnet.tar.gz
RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
RUN if ! command -v curl &> /dev/null; then apt-get update; apt-get install -y curl; fi \
&& curl -fSL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \
&& mkdir -p /usr/share/dotnet \
&& tar -oxzf dotnet.tar.gz -C /usr/share/dotnet

FROM mcr.microsoft.com/powershell:${VERSION}-ubuntu-${UBUNTU_VERSION}
# Copy the dotnet installation.
COPY --from=0 /usr/share/dotnet /usr/share/dotnet
RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
# Copy the application code.
WORKDIR /app
COPY . .

# Restore dependencies and run tests.
CMD pwsh tools/restore.ps1; pwsh tools/run-tests.ps1
CMD pwsh tools/restore.ps1; pwsh tools/run-tests.ps1