microsoft / PSRule

Validate infrastructure as code (IaC) and objects using PowerShell rules.
https://microsoft.github.io/PSRule/v2/
MIT License
390 stars 51 forks source link

Add walkthrough for running PSRule within a Docker container #50

Closed BernieWhite closed 1 year ago

BernieWhite commented 5 years ago

Currently PSRule supports Windows using PowerShell 5.1 and above.

This is great for Windows administrators however not great for everyone else. When enabling validation within a CI/CD pipeline, the agent platform might not be Windows.

Containers provide portability and consistency which is very applicable for PSRule.

PowerShell is already available in a published Docker container.

docker pull mcr.microsoft.com/powershell

i.e.

docker run -it --rm mcr.microsoft.com/powershell
BernieWhite commented 5 years ago

Requires #49

BernieWhite commented 5 years ago

An example Dockerfile.

FROM mcr.microsoft.com/powershell:ubuntu-16.04
SHELL ["pwsh", "-command"]
RUN Install-Module -Name PSRule -AllowPrerelease -Force;
RUN Import-Module -Name PSRule;

ARG IMAGE_NAME=PSRule:0.2.0-ubuntu-16.04

LABEL maintainer="Bernie White" \
      readme.md="https://github.com/BernieWhite/PSRule/blob/master/README.md" \
      description="This Dockerfile will install the PSRule PowerShell module."

CMD [ "pwsh" ]
BernieWhite commented 5 years ago

At this stage providing tooling is not required. This issue should focus on documention.