acs-engine Docker Image Rework (#2784)

This commit reworks Dockerfile.linux to make it more in-line with Docker
and Linux best practices.

* Set entrypoint to acs-engine
* Set default parameters to show acs-engine help
* Set default ACSENGINE_VERSION to latest release
* Remove unnecessary curl install
* Remove unnecessary bash install
* Use /opt/ as intall dir rather than root home
* Newer version of alpine
* Update README to use latest release version
This commit is contained in:
Aaron Peschel 2018-05-02 16:03:06 -07:00 коммит произвёл Jack Francis
Родитель 94013a4d76
Коммит 914172d3cd
2 изменённых файлов: 22 добавлений и 21 удалений

Просмотреть файл

@ -1,6 +1,6 @@
FROM alpine:3.6
FROM alpine:3.7
ARG ACSENGINE_VERSION
ARG ACSENGINE_VERSION=0.16.0
ARG BUILD_DATE
# Metadata as defined at http://label-schema.org
@ -17,15 +17,16 @@ LABEL maintainer="Microsoft" \
org.label-schema.vcs-url="https://github.com/Azure/acs-engine.git" \
org.label-schema.docker.cmd="docker run -v \${PWD}:/acs-engine/workspace -it --rm microsoft/acs-engine:$ACSENGINE_VERSION"
RUN apk add --update bash curl && \
rm -rf /var/cache/apk/*
ADD "https://github.com/Azure/acs-engine/releases/download/v${ACSENGINE_VERSION}/acs-engine-v${ACSENGINE_VERSION}-linux-amd64.tar.gz" /tmp/acs-engine.tgz
RUN curl -L "https://github.com/Azure/acs-engine/releases/download/v${ACSENGINE_VERSION}/acs-engine-v${ACSENGINE_VERSION}-linux-amd64.tar.gz" | tar xvz -C ~ && \
chown -R root:root ~/acs-engine-v${ACSENGINE_VERSION}-linux-amd64 && \
ln -s ~/acs-engine-v${ACSENGINE_VERSION}-linux-amd64/acs-engine /usr/local/bin/acs-engine && \
chmod +x /usr/local/bin/acs-engine && \
echo 'PS1="acs-engine# "' > ~/.bashrc
RUN mkdir /opt/ && \
tar xvzf /tmp/acs-engine.tgz -C /opt/ && \
rm /tmp/acs-engine.tgz && \
chown -R root:root /opt/acs-engine-v${ACSENGINE_VERSION}-linux-amd64 && \
ln -s /opt/acs-engine-v${ACSENGINE_VERSION}-linux-amd64/acs-engine /usr/local/bin/acs-engine && \
chmod +x /usr/local/bin/acs-engine
WORKDIR /acs-engine/workspace
CMD bash
ENTRYPOINT [ "acs-engine" ]
CMD [ "--help" ]

Просмотреть файл

@ -2,12 +2,12 @@
**Bash**
```bash
$ VERSION=0.8.0
$ VERSION=0.16.0
$ docker build --no-cache --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg ACSENGINE_VERSION="$VERSION" -t microsoft/acs-engine:$VERSION --file ./Dockerfile.linux .
```
**PowerShell**
```powershell
PS> $VERSION="0.8.0"
PS> $VERSION="0.16.0"
PS> docker build --no-cache --build-arg BUILD_DATE=$(Get-Date((Get-Date).ToUniversalTime()) -UFormat "%Y-%m-%dT%H:%M:%SZ") --build-arg ACSENGINE_VERSION="$VERSION" -t microsoft/acs-engine:$VERSION --file .\Dockerfile.linux .
```
@ -15,12 +15,12 @@ PS> docker build --no-cache --build-arg BUILD_DATE=$(Get-Date((Get-Date).ToUnive
**Bash**
```bash
$ docker image inspect microsoft/acs-engine:0.8.0 --format "{{json .Config.Labels}}" | jq
$ docker image inspect microsoft/acs-engine:0.16.0 --format "{{json .Config.Labels}}" | jq
{
"maintainer": "Microsoft",
"org.label-schema.build-date": "2017-10-25T04:35:06Z",
"org.label-schema.description": "The Azure Container Service Engine (acs-engine) generates ARM (Azure Resource Manager) templates for Docker enabled clusters on Microsoft Azure with your choice of DCOS, Kubernetes, or Swarm orchestrators.",
"org.label-schema.docker.cmd": "docker run -v ${PWD}:/acs-engine/workspace -it --rm microsoft/acs-engine:0.8.0",
"org.label-schema.docker.cmd": "docker run -v ${PWD}:/acs-engine/workspace -it --rm microsoft/acs-engine:0.16.0",
"org.label-schema.license": "MIT",
"org.label-schema.name": "Azure Container Service Engine (acs-engine)",
"org.label-schema.schema-version": "1.0",
@ -28,18 +28,18 @@ $ docker image inspect microsoft/acs-engine:0.8.0 --format "{{json .Config.Label
"org.label-schema.usage": "https://github.com/Azure/acs-engine/blob/master/docs/acsengine.md",
"org.label-schema.vcs-url": "https://github.com/Azure/acs-engine.git",
"org.label-schema.vendor": "Microsoft",
"org.label-schema.version": "0.8.0"
"org.label-schema.version": "0.16.0"
}
```
**PowerShell**
```powershell
PS> docker image inspect microsoft/acs-engine:0.8.0 --format "{{json .Config.Labels}}" | ConvertFrom-Json | ConvertTo-Json
PS> docker image inspect microsoft/acs-engine:0.16.0 --format "{{json .Config.Labels}}" | ConvertFrom-Json | ConvertTo-Json
{
"maintainer": "Microsoft",
"org.label-schema.build-date": "2017-10-25T04:35:06Z",
"org.label-schema.description": "The Azure Container Service Engine (acs-engine) generates ARM (Azure Resource Manager) templates for Docker enabled clusters on Microsoft Azure with your choice of DCOS, Kubernetes, or Swarm orchestrators.",
"org.label-schema.docker.cmd": "docker run -v ${PWD}:/acs-engine/workspace -it --rm microsoft/acs-engine:0.8.0",
"org.label-schema.docker.cmd": "docker run -v ${PWD}:/acs-engine/workspace -it --rm microsoft/acs-engine:0.16.0",
"org.label-schema.license": "MIT",
"org.label-schema.name": "Azure Container Service Engine (acs-engine)",
"org.label-schema.schema-version": "1.0",
@ -47,12 +47,12 @@ PS> docker image inspect microsoft/acs-engine:0.8.0 --format "{{json .Config.Lab
"org.label-schema.usage": "https://github.com/Azure/acs-engine/blob/master/docs/acsengine.md",
"org.label-schema.vcs-url": "https://github.com/Azure/acs-engine.git",
"org.label-schema.vendor": "Microsoft",
"org.label-schema.version": "0.8.0"
"org.label-schema.version": "0.16.0"
}
```
# Run Docker image
```
$ docker run -v ${PWD}:/acs-engine/workspace -it --rm microsoft/acs-engine:0.8.0
$ docker run -v ${PWD}:/acs-engine/workspace -it --rm microsoft/acs-engine:0.16.0
```