Skip to content

Commit

Permalink
Merged PR 464101: Rename docker images in prep for multi-arch
Browse files Browse the repository at this point in the history
Rename docker images in prep for multi-arch
* This updates architecture from `x64` -> `amd64` and `armv7hf` -> `arm32v7`
* Renames all images to the form `azureiotedge/*` instead of `azedge-*`

Updates all the build scripts to produce the new images.
  • Loading branch information
myagley committed Oct 13, 2017
1 parent a113520 commit faa1020
Show file tree
Hide file tree
Showing 29 changed files with 29 additions and 45 deletions.
1 change: 0 additions & 1 deletion edge-agent/docker/linux/x64/Dockerfile → edge-agent/docker/linux/amd64/Dockerfile
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM microsoft/dotnet:2.0.0-runtime

ARG EXE_DIR=.
ENV DockerLoggingDriver=journald

WORKDIR /app

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM microsoft/dotnet:2.0.0-runtime-stretch-arm32v7

ARG EXE_DIR=.
ENV DockerLoggingDriver=journald

WORKDIR /app

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ process_args()

if [ -z ${ARCH} ]; then
if [ "x86_64" == "$(uname -m)" ]; then
ARCH="x64"
ARCH="amd64"
else
ARCH="armv7hf"
ARCH="arm32v7"
fi
echo "Detected architecture: $ARCH"
fi
Expand Down Expand Up @@ -173,19 +173,19 @@ if [ $(sudo docker ps -a | grep $image_name | wc -l) -ne 0 ]; then
fi

# Remove any existing edge-service images
if [ $(sudo docker images | grep "edgebuilds.azurecr.io/azedge-edge-service-$ARCH" | wc -l) -ne 0 ]; then
sudo docker rmi $(sudo docker images | grep "edgebuilds.azurecr.io/azedge-edge-service-$ARCH" | egrep -o '[a-fA-F0-9]{12}')
if [ $(sudo docker images | grep "edgebuilds.azurecr.io/azureiotedge/edge-service-linux-$ARCH" | wc -l) -ne 0 ]; then
sudo docker rmi $(sudo docker images | grep "edgebuilds.azurecr.io/azureiotedge/edge-service-linux-$ARCH" | egrep -o '[a-fA-F0-9]{12}')
fi

# Pull current release version
sudo docker pull edgebuilds.azurecr.io/azedge-edge-service-$ARCH:$DOCKER_IMAGEVERSION
sudo docker pull edgebuilds.azurecr.io/azureiotedge/edge-service-linux-$ARCH:$DOCKER_IMAGEVERSION
if [ $? -ne 0 ]; then
echo "Docker Pull Failed!"
exit 1
fi

# Run current release version
sudo docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name $image_name -p 8883:8883 -p 443:443 -e DockerUri=unix:///var/run/docker.sock -e DeviceConnectionString=$mma_connection -e IotHubHostName=$IOTHUB_HOSTNAME -e EdgeDeviceId=$DEVICEID "${docker_routes[@]}" edgebuilds.azurecr.io/azedge-edge-service-$ARCH:$DOCKER_IMAGEVERSION
sudo docker run -d -v /var/run/docker.sock:/var/run/docker.sock --name $image_name -p 8883:8883 -p 443:443 -e DockerUri=unix:///var/run/docker.sock -e DeviceConnectionString=$mma_connection -e IotHubHostName=$IOTHUB_HOSTNAME -e EdgeDeviceId=$DEVICEID "${docker_routes[@]}" edgebuilds.azurecr.io/azureiotedge/edge-service-linux-$ARCH:$DOCKER_IMAGEVERSION
if [ $? -ne 0 ]; then
echo "Docker run Failed!"
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ if ($vNext)
{
$suffix = "-vnext"
}
$tag = "edgebuilds.azurecr.io/azedge-edge-service-windows$suffix-x64:$ImageVersion"
$tag = "edgebuilds.azurecr.io/azureiotedge/edge-service-windows$suffix-amd64:$ImageVersion"

$Password | docker login $Registry -u $Username --password-stdin
if ($LastExitCode)
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/edge-hub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
spec:
containers:
- name: edge-hub
image: edgebuilds.azurecr.io/azedge-edge-hub-x64:latest
image: edgebuilds.azurecr.io/azureiotedge/edge-hub-linux-amd64:latest
ports:
- containerPort: 8883
env:
Expand Down
File renamed without changes.
26 changes: 6 additions & 20 deletions scripts/linux/buildDockerImage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ SCRIPT_NAME=$(basename $0)
PUBLISH_DIR=
DOTNET_DOWNLOAD_URL=
BUILD_BINARIESDIRECTORY=${BUILD_BINARIESDIRECTORY:=""}
SKIP_RUNTIME=0

###############################################################################
# Function to obtain the underlying architecture and check if supported
###############################################################################
check_arch()
{
if [ "$ARCH" == "x86_64" ]; then
ARCH="x64"
ARCH="amd64"
elif [ "$ARCH" == "armv7l" ]; then
ARCH="armv7hf"
ARCH="arm32v7"
else
echo "Unsupported Architecture"
exit 1
Expand Down Expand Up @@ -100,7 +99,6 @@ process_args()
"--bin-dir" ) save_next_arg=5;;
"--dotnet-url" ) save_next_arg=6;;
"-t" | "--target-arch" ) save_next_arg=7;;
"--skip-runtime" ) SKIP_RUNTIME=1;;
* ) usage;;
esac
fi
Expand Down Expand Up @@ -169,8 +167,8 @@ docker_build_and_tag_and_push()

echo "Building and Pushing Docker image $imagename for $arch"
docker_build_cmd="docker build --no-cache"
docker_build_cmd+=" -t $DOCKER_REGISTRY/azedge-$imagename-$arch:$DOCKER_IMAGEVERSION"
docker_build_cmd+=" -t $DOCKER_REGISTRY/azedge-$imagename-$arch:latest"
docker_build_cmd+=" -t $DOCKER_REGISTRY/azureiotedge/$imagename-linux-$arch:$DOCKER_IMAGEVERSION"
docker_build_cmd+=" -t $DOCKER_REGISTRY/azureiotedge/$imagename-linux-$arch:latest"
if [ ! -z "${dockerfile}" ]; then
docker_build_cmd+=" --file $dockerfile"
fi
Expand All @@ -184,12 +182,12 @@ docker_build_and_tag_and_push()
echo "Docker Build Failed With Exit Code $?"
exit 1
else
docker push $DOCKER_REGISTRY/azedge-$imagename-$arch:$DOCKER_IMAGEVERSION
docker push $DOCKER_REGISTRY/azureiotedge/$imagename-linux-$arch:$DOCKER_IMAGEVERSION
if [ $? -ne 0 ]; then
echo "Docker Build Failed With Exit Code $?"
exit 1
else
docker push $DOCKER_REGISTRY/azedge-$imagename-$arch:latest
docker push $DOCKER_REGISTRY/azureiotedge/$imagename-linux-$arch:latest
if [ $? -ne 0 ]; then
echo "Docker Push Latest Image Failed: $?"
exit 1
Expand All @@ -213,18 +211,6 @@ if [ $? -ne 0 ]; then
exit 1
fi

# push edge-runtime dotnet image
if [ $SKIP_RUNTIME -eq 0 ]; then
EXE_DIR="dotnet-runtime"
EXE_DOCKER_DIR=$PUBLISH_DIR/docker/$EXE_DIR/latest
DOTNET_BUILD_ARG=""
if [[ ! -z ${DOTNET_DOWNLOAD_URL} ]]; then
DOTNET_BUILD_ARG="--build-arg DOTNET_DOWNLOAD_URL=$DOTNET_DOWNLOAD_URL"
fi
docker_build_and_tag_and_push $EXE_DIR "$ARCH" "$EXE_DOCKER_DIR/$ARCH/Dockerfile" "$EXE_DOCKER_DIR" "$DOTNET_BUILD_ARG"
[ $? -eq 0 ] || exit $?
fi

# push edge-agent image
EXE_DIR="Microsoft.Azure.Devices.Edge.Agent.Service"
EXE_DOCKER_DIR=$PUBLISH_DIR/$EXE_DIR/docker
Expand Down
18 changes: 9 additions & 9 deletions scripts/windows/buildDockerImage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if (-not (Test-Path $PublishDir))

switch ($TargetArch)
{
"AMD64" { $TargetArch = "x64" }
"AMD64" { $TargetArch = "amd64" }
default { throw "Unsupported arch '$TargetArch'" }
}

Expand All @@ -76,19 +76,19 @@ Function docker_login()
Function docker_build_and_tag_and_push(
# Name of the docker edge image to publish
[Parameter(Mandatory = $true)]
[String]$ImageName,
[String]$ImageName,

# Arch of base image
[Parameter(Mandatory = $true)]
[String]$Arch,
[String]$Arch,

# Path to the dockerfile
[ValidateNotNullOrEmpty()]
[String]$Dockerfile,
[String]$Dockerfile,

# Docker context path
[Parameter(Mandatory = $true)]
[String]$ContextPath,
[String]$ContextPath,

# Build args
[String]$BuildArgs,
Expand All @@ -103,16 +103,16 @@ Function docker_build_and_tag_and_push(
{
$Suffix = "-vnext"
}
$TagPrefix = "$Registry/azedge-$ImageName-windows${Suffix}-${Arch}"
$TagPrefix = "$Registry/azureiotedge/$ImageName-windows${Suffix}-${Arch}"
$FullVersionTag = "${TagPrefix}:$ImageVersion"
$LatestVersionTag = "${TagPrefix}:latest"

echo "Building and Pushing Docker image $ImageName for $Arch"
if ($Tag)
{
{
$docker_build_cmd = "docker build --no-cache -t $Tag"
}
else
else
{
$docker_build_cmd = "docker build --no-cache -t $FullVersionTag -t $LatestVersionTag"
}
Expand All @@ -137,7 +137,7 @@ Function docker_build_and_tag_and_push(
{
Throw "Docker Push Failed With Exit Code $LastExitCode"
}

docker push $LatestVersionTag
if ($LastExitCode)
{
Expand Down
12 changes: 6 additions & 6 deletions scripts/windows/pushPrivatePreview.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ if "%pushos%"=="linux" if not "%dockeros%"=="linux" goto osmismatch
if "%pushos%"=="windows" if not "%dockeros%"=="windows" goto osmismatch

if "%pushos%"=="windows" (
set "image[0]=azedge-edge-service-windows-x64"
set "image[1]=azedge-simulated-temperature-sensor-windows-x64"
set "image[0]=azureiotedge/edge-service-windows-amd64"
set "image[1]=azureiotedge/simulated-temperature-sensor-windows-amd64"
) else (
set "image[0]=azedge-edge-service-x64"
set "image[1]=azedge-simulated-temperature-sensor-x64"
set "image[2]=azedge-edge-service-armv7hf"
set "image[3]=azedge-simulated-temperature-sensor-armv7hf"
set "image[0]=azureiotedge/edge-service-amd64"
set "image[1]=azureiotedge/simulated-temperature-sensor-amd64"
set "image[2]=azureiotedge/edge-service-arm32v7"
set "image[3]=azureiotedge/simulated-temperature-sensor-arm32v7"
)

echo.
Expand Down

0 comments on commit faa1020

Please sign in to comment.