Remove nightly docker images (#4052)

This commit is contained in:
Travis Plunk
2017-06-20 10:42:26 -07:00
committed by Dongbo Wang
parent 3543498ee3
commit 5a84e60c13
8 changed files with 68 additions and 253 deletions
+2
View File
@@ -165,6 +165,8 @@ journalctl
SystemD
- docker/README.md
andschwa's
hub.docker.com
microsoft
- docs/building/internals.md
Catalog
src
+65 -95
View File
@@ -1,8 +1,6 @@
Docker
======
# Docker
These DockerFiles enable building and running PowerShell in a container for each Linux distribution we support.
There are two sets: release and nightly.
These DockerFiles enable running PowerShell in a container for each Linux distribution we support.
This requires an up-to-date version of Docker, such as 1.12.
It also expects you to be able to run Docker without `sudo`.
@@ -10,8 +8,7 @@ Please follow [Docker's official instructions][install] to install `docker` corr
[install]: https://docs.docker.com/engine/installation/
Release
-------
## Release
The release containers derive from the official distribution image,
such as `centos:7`, then install dependencies,
@@ -26,65 +23,7 @@ and about 120 megabytes of .NET Core and bootstrapping dependencies.
[docker-release]: https://hub.docker.com/r/microsoft/powershell/
Nightly
-------
The nightly containers derive from their respective release images,
such as `microsoft/powershell:centos7`,
then run the `bootstrap.ps1` script which clones the repository,
runs `Start-PSBootstrap -Package` to install building and packaging tools,
runs `Start-PSBuild -Crossgen -PSModuleRestore` to build PowerShell with native-image DLLs,
runs `Start-PSPackage` to generate the platform's package,
and finally installs the generated package.
These containers live at [hub.docker.com/r/microsoft/powershell-nightly][docker-nightly].
At about 4 gigabytes,
these images are *much* larger due to having all the tools installed.
This is intended so that the containers are useful for reproducing packages.
[docker-nightly]: https://hub.docker.com/r/microsoft/powershell-nightly/
Automation
==========
A script, `launch.sh`, exists to automatically build all the respective images.
It has a few configuration options,
passed in as environment variables:
* `FORK`: the fork to clone in nightly builds (default: `PowerShell`)
* Set `FORK=andschwa` to clone https://github.com/andschwa/PowerShell
* `BRANCH`: the branch to checkout in nightly builds (default: `master`)
* Set `BRANCH=feature-A` to checkout the `feature-A` branch
* `BUILDS`: the type of builds to run (default: `release nightly`)
* This is order dependent! Release images must exist for nightly images to be built
* Set `BUILDS=release` to run the script for just the release images
* `DISTROS`: the distributions of Linux to run (default: `ubuntu14.04 ubuntu16.04 centos7`)
* Set `DISTROS=centos7` to build just CentOS 7 images
* Combine with `BUILDS` to filter
* `TEST`: set to 1 to `docker run Start-PSPester` inside the containers
* The containers *must* first exist; this skips the build step
* `BUILDARGS`: additional arguments to be passed to `docker build` during building
* Set `BUILDARGS="--no-cache"` to rebuild and ignore cached layers
* `RUNARGS`: additional arguments to be passed to `docker run` during testing
* Set `RUNARGS="--rm"` to automatically delete the test container when finished
For each build type (release and nightly),
the selected distributions will run in parallel.
The output is sent to log files in `docker/logs`.
For nightly builds, the generated packages are copied to `docker/packages`.
This script is very new, and there may be bugs.
Use `set -x` to see exactly what commands it is running.
Examples
--------
## Examples
To run PowerShell from using a container:
@@ -103,46 +42,77 @@ adf6ad28fa0e: Pull complete
Digest: sha256:92c79c5fcdaf3027626643aef556344b8b4cbdaccf8443f543303319949c7f3a
Status: Downloaded newer image for microsoft/powershell:latest
PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
Copyright © 2016 Microsoft Corporation. All rights reserved.
PS /> Write-Host "Hello, World!"
Hello, World!
```
To build a CentOS container with the latest released package:
## Building the images
The images are built with the [`docker image build`](https://docs.docker.com/engine/reference/commandline/image_build/) command.
### Example
```sh
$ BUILDS=release DISTROS=centos7 ./launch.sh
Logging to docker/logs/release/centos7.log
Waiting for release containers to finish; tail the logs for more information.
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
microsoft/powershell centos7 f0a11a8009b7 20 minutes ago 438.3 MB
...
PS /powershell/docker> cd ./release/ubuntu16.04/
PS /powershell/docker/release/ubuntu16.04> docker image build -t ps-ubuntu.16.04 .
Sending build context to Docker daemon 3.072 kB
Step 1/12 : FROM ubuntu:xenial
---> 7b9b13f7b9c0
Step 2/12 : LABEL maintainer "PowerShell Team <powershellteam@hotmail.com>"
---> Using cache
---> c6515b7d596f
Step 3/12 : LABEL readme.md "https://github.com/PowerShell/PowerShell/blob/master/docker/README.md"
---> Using cache
---> 721306ae4490
Step 4/12 : LABEL description "This Dockerfile will install the latest release of PS."
---> Using cache
---> 80c06f5481d2
Step 5/12 : RUN apt-get update && apt-get install -y --no-install-recommends apt-utils ca-certificates curl apt-transport-https locales && rm -rf /var/lib/apt/lists/*
---> Using cache
---> 2d08e2300fc9
Step 6/12 : ENV LANG en_US.UTF-8
---> Using cache
---> 6dfc363111c0
Step 7/12 : ENV LC_ALL $LANG
---> Using cache
---> b7ef2cd3a7ed
Step 8/12 : RUN locale-gen $LANG && update-locale
---> Using cache
---> e75306ddf3e0
Step 9/12 : RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
---> Using cache
---> f476b7be22a2
Step 10/12 : RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | tee /etc/apt/sources.list.d/microsoft.list
---> Using cache
---> 909ca8e33a3b
Step 11/12 : RUN apt-get update && apt-get install -y --no-install-recommends powershell
---> Using cache
---> f32b54204619
Step 12/12 : ENTRYPOINT powershell
---> Using cache
---> ee667ad86a7b
Successfully built ee667ad86a7b
```
To generate an Ubuntu 16.04 package from andschwa's `docker` branch:
### Run the docker image you built
```sh
$ DISTROS=ubuntu16.04 FORK=andschwa BRANCH=docker ./launch.sh
Logging to docker/logs/release/ubuntu16.04.log
Waiting for release containers to finish; tail the logs for more information.
Logging to docker/logs/nightly/ubuntu16.04.log
Waiting for nightly containers to finish; tail the logs for more information.
PS /powershell/docker/release/ubuntu16.04> docker run -it ps-ubuntu.16.04 '$psversiontable'
$ ls packages
powershell_6.0.0-alpha.10-310-g5ded651-1ubuntu1.16.04.1_amd64.deb
Name Value
---- -----
PSVersion 6.0.0-beta
PSEdition Core
BuildVersion 3.0.0.0
CLRVersion
GitCommitId v6.0.0-beta.2
OS Linux 4.9.27-moby #1 SMP Thu May 11 04:01:18 ...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
$ tail logs/nightly/ubuntu16.04.log
Step 5 : COPY bootstrap.ps1 /
---> Using cache
---> d18a28ff1e3d
Step 6 : RUN powershell -f bootstrap.ps1 && dpkg -i PowerShell/powershell*.deb
---> Using cache
---> 9cd8b1ef79b3
Successfully built 9cd8b1ef79b3
LOG: Saving package to docker/packages
~/src/PowerShell/docker ~/src/PowerShell/docker
'/PowerShell/powershell_6.0.0-alpha.10-310-g5ded651-1ubuntu1.16.04.1_amd64.deb' -> '/mnt/powershell_6.0.0-alpha.10-310-g5ded651-1ubuntu1.16.04.1_amd64.deb'
```
```
-88
View File
@@ -1,88 +0,0 @@
#!/usr/bin/env bash
set -e
# This is borrowed from https://github.com/dotnet/cli/blob/18456af5caeae44defc23ad5579c838c1fda3c3d/run.sh
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# run from directory of launch.sh so artifacts are placed appropriately
pushd "$DIR"
if [[ -z "$FORK" ]]; then
FORK=PowerShell
fi
if [[ -z "$BRANCH" ]]; then
BRANCH=master
fi
# Build both sets by default
if [[ -z "$BUILDS" ]]; then
BUILDS="release nightly"
fi
# Build specified distributions
if [[ -z $DISTROS ]]; then
DISTROS="ubuntu14.04 ubuntu16.04 centos7"
fi
for build in $BUILDS; do
# each distro can be done in parallel; but release must be done before nightly
for distro in $DISTROS; do
logfile="$distro.log"
if [[ "$TEST" -eq 1 ]]; then logfile="test-$logfile"; fi
mkdir -p "logs/$build"
logfile="logs/$build/$logfile"
echo "Logging to docker/$logfile"
if [[ "$build" = release ]]; then
repo="microsoft/powershell"
else
repo="microsoft/powershell-nightly"
fi
(
image="$repo:$distro"
pushd "$build"
if [[ "$TEST" -eq 1 ]]; then
echo "LOG: testing $image"
command="cd PowerShell; Import-Module ./build.psm1; Install-Dotnet -NoSudo; Start-PSPester -powershell powershell -Pester ./src/Modules/Shared/Pester"
# clone repo for release images because it's not already done
if [[ "$build" = release ]]; then
command="git clone --recursive https://github.com/$FORK/PowerShell -b $BRANCH; $command"
fi
# run Pester tests inside container
# RUNARGS can be set in the environment
docker run $RUNARGS "$image" -c "$command"
else
echo "LOG: building $image"
# copy the common script because it lives outside the docker build context
if [[ "$build" = nightly ]]; then
cp bootstrap.ps1 "$distro"
buildargs="--build-arg fork=$FORK --build-arg branch=$BRANCH"
fi
# build and tag the image so they can be derived from
# BUILDARGS can be set in the environment
docker build $buildargs $BUILDARGS -t "$image" "$distro"
if [[ "$build" = nightly ]]; then
echo "LOG: Saving package to docker/packages"
popd
mkdir -p packages
command='cp -vf /PowerShell/powershell*{deb,rpm} /mnt 2> /dev/null'
# override entrypoint to be bash so we can use globbing
docker run --rm --volume "$(pwd)/packages:/mnt" --entrypoint bash "$image" -c "$command"
fi
fi
) &>> "$logfile" &
done
echo "Waiting for $build containers to finish; tail the logs for more information."
wait
done
popd
-18
View File
@@ -1,18 +0,0 @@
FROM microsoft/powershell:centos7
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>"
LABEL readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md"
LABEL description="This Dockerfile will install the latest release of PS."
ARG fork=PowerShell
ARG branch=master
SHELL ["powershell", "-command"]
RUN git clone --recursive https://github.com/$env:fork/PowerShell.git -b $env:branch; \
Set-Location PowerShell; \
Import-Module ./build.psm1; \
Start-PSBootstrap -Package -NoSudo; \
Start-PSBuild -Crossgen -PSModuleRestore; \
Start-PSPackage;
SHELL ["/bin/sh", "-c"]
RUN yum install -y PowerShell/powershell*.rpm
-17
View File
@@ -1,17 +0,0 @@
FROM microsoft/powershell:fedora24
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>"
LABEL readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md"
LABEL description="This Dockerfile will install the latest release of PS."
ARG fork=PowerShell
ARG branch=master
SHELL ["powershell", "-command"]
RUN git clone --recursive https://github.com/$env:fork/PowerShell.git -b $env:branch; \
Set-Location PowerShell; \
Import-Module ./build.psm1; \
Start-PSBootstrap -Package -NoSudo; \
Start-PSBuild -Crossgen -PSModuleRestore; \
Start-PSPackage;
SHELL ["/bin/sh", "-c"]
RUN dnf install -y PowerShell/powershell*.rpm
-17
View File
@@ -1,17 +0,0 @@
FROM microsoft/powershell:ubuntu14.04
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>"
LABEL readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md"
LABEL description="This Dockerfile will install the latest release of PS."
ARG fork=PowerShell
ARG branch=master
SHELL ["powershell", "-command"]
RUN git clone --recursive https://github.com/$env:fork/PowerShell.git -b $env:branch; \
Set-Location PowerShell; \
Import-Module ./build.psm1; \
Start-PSBootstrap -Package -NoSudo; \
Start-PSBuild -Crossgen -PSModuleRestore; \
Start-PSPackage;
SHELL ["/bin/sh", "-c"]
RUN dpkg -i PowerShell/powershell*.deb
-18
View File
@@ -1,18 +0,0 @@
FROM microsoft/powershell:ubuntu16.04
LABEL maintainer="PowerShell Team <powershellteam@hotmail.com>"
LABEL readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md"
LABEL description="This Dockerfile will install the latest release of PS."
ARG fork=PowerShell
ARG branch=master
SHELL ["powershell", "-command"]
RUN git clone --recursive https://github.com/$env:fork/PowerShell.git -b $env:branch; \
Set-Location PowerShell; \
Import-Module ./build.psm1; \
Start-PSBootstrap -Package -NoSudo; \
Start-PSBuild -Crossgen -PSModuleRestore; \
Start-PSPackage;
SHELL ["/bin/sh", "-c"]
RUN dpkg -i PowerShell/powershell*.deb
+1
View File
@@ -76,6 +76,7 @@ Describe 'Common Tests - Validate Markdown Files' -Tag 'CI' {
'./docs/*.md'
'./docs/installation/*.md'
'./demos/SSHRemoting/*.md'
'./docker/*.md'
)
$filter = ($docsToTest -join ',')
&"gulp" test-mdsyntax --silent `