Update Docker image builds to use newer tooling (#6878)

Docker recently introduced [provenance attestation](https://docs.docker.com/build/attestations/slsa-provenance/) in buildx 0.10.0, which broke our multi-arch image builds. To build our multi-arch manifests, we use a really old tool that isn't compatible with the buildx changes. To work around the problem, we disabled provenance attestation in our builds (see f82a7d94f3).

With this change, we re-enable provenance attestation and upgrade our multi-arch build tooling to support it.

I also took this opportunity to refactor our Dockerfiles into a single Dockerfile per module except API Proxy (which structures its x64 and arm images very differently). I initially did this refactoring because I planned to upgrade our pipelines/scripts to the canonical method for building Docker images: passing a comma-separated list of platforms to `docker buildx build` and letting it build the images _and_ the multi-arch manifest at once. This method would have required a single Dockerfile for all architectures. However, since we provide per-architecture tags for our images, it ended up being easier to keep our current pattern (build each single-arch image, then create the multi-arch manifest separately) and just upgrade the tools.

Other changes:
- In cases where I was already updating a pipeline script task (e.g., to add/change a parameter passed to a script), I converted the task syntax to use the newer 'script' alias for consistency with other pipelines.
- In our API Proxy pipelines, there were three different places where we installed qemu and binfmt to prepare for cross-compiling the code, but the agent already has those installed so I removed it.
- Also in our API Proxy pipelines, there was a place where we did some docker buildx setup even though the job doesn't use docker buildx. Maybe it used to? Anyway, I removed the setup task.
- Removed the explicit bin_dir argument from all image-linux.yaml calls, since it is redundant with that parameter's default value.
- Deleted all manifest.yaml.template files, since they were required for the old manifest tool and are no longer used.
- In some of our release pipelines we have a default value for the 'tags' parameter that is given in not-quite-JSON format (an array with a single string value in _single_ quotes). I changed it to valid JSON so I can use jq to merge it with other tags when building the multi-arch image.
- Removed the unused '--postfix' parameter from buildRocksDb.sh.
- Removed the redundant and misnamed '--image-name' parameter from buildApiProxy.sh.
- Cleaned up script variables and args parsing for consistency, and in a few cases to fix minor bugs.

To test, I ran the CI build, which exercises the key YAML templates and all the scripts. I also ran the end-to-end tests and nested end-to-end tests to verify that the images still work as expected.

## Azure IoT Edge PR checklist:
This commit is contained in:
Damon Barry 2023-02-03 10:36:13 -08:00 коммит произвёл GitHub
Родитель e70936fbb2
Коммит e6fc2eef09
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
95 изменённых файлов: 385 добавлений и 1349 удалений

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

@ -54,9 +54,11 @@ jobs:
filePath: '$(System.DefaultWorkingDirectory)/scripts/linux/moveImage.sh'
arguments: '--from $(registry.address)/$(from.registry.namespace)/azureiotedge-api-proxy:$(version)-linux-arm64v8 --to $(registry.address)/$(to.registry.namespace)/azureiotedge-api-proxy:$(version)-linux-arm64v8'
- task: Bash@3
- script: |
scripts/linux/buildManifest.sh \
-r $(registry.address) \
-i 'azureiotedge-api-proxy' \
-v $(version) \
-n $(to.registry.namespace) \
--tags '$(tags)'
displayName: 'Publish Api Proxy Manifest'
inputs:
targetType: filePath
filePath: '$(System.DefaultWorkingDirectory)/scripts/linux/buildManifest.sh'
arguments: '-r $(registry.address) -v $(version) -t $(System.DefaultWorkingDirectory)/edge-modules/api-proxy-module/docker/manifest.yaml.template -n $(to.registry.namespace) --tags "$(tags)"'

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

@ -91,8 +91,6 @@ stages:
else
echo '##vso[task.setvariable variable=buildVersion]$(version)'
fi
sudo apt-get update && sudo apt-get -y install qemu binfmt-support qemu-user-static && \
docker -v
displayName: 'Set build version'
- template: templates/image-linux.yaml
parameters:
@ -100,7 +98,6 @@ stages:
imageName: azureiotedge-api-proxy
project: api-proxy-module
version: $(buildVersion)
bin_dir: '$(Build.BinariesDirectory)'
################################################################################
- stage: PublishManifests
@ -114,10 +111,6 @@ stages:
jobs:
- job: PublishManifest
displayName: Publish Manifest
strategy:
matrix:
ApiProxy:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-modules/api-proxy-module/docker/manifest.yaml.template'
steps:
# Both docker logins needed for if we need to test this job. In this case images should go to edgebuilds.
- task: Docker@2
@ -137,7 +130,14 @@ stages:
echo '##vso[task.setvariable variable=buildVersion]$(version)'
fi
displayName: 'Set build version'
- script: scripts/linux/buildManifest.sh -r $(registry.address) -v $(buildVersion) -t $(manifestFilePath) -n microsoft --tags "$(tags)"
- script: |
scripts/linux/buildManifest.sh \
-r $(registry.address) \
-i 'azureiotedge-api-proxy' \
-v $(buildVersion) \
-n 'microsoft' \
--tags '$(tags)'
displayName: 'Create Api Proxy manifest'
- job: ComponentGovernance
steps:

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

@ -204,38 +204,38 @@ jobs:
echo "##vso[task.setvariable variable=tempSensor.tags;]$TEMP_SENSOR_TAGS_STR"
displayName: Set Version and Tags
- task: Bash@3
- script: |
scripts/linux/buildManifest.sh \
-r "$(to.registry.address)" \
-i "azureiotedge-agent" \
-v "$(resources.pipeline.images.runName)" \
-n "$(to.registry.namespace)" \
--tags '$(tags)'
displayName: 'Publish Edge Agent Manifest'
inputs:
targetType: filePath
filePath: '$(System.DefaultWorkingDirectory)/scripts/linux/buildManifest.sh'
arguments: '-r "$(to.registry.address)" -v "$(resources.pipeline.images.runName)" -t $(System.DefaultWorkingDirectory)/edge-agent/docker/manifest.yaml.template -n "$(to.registry.namespace)" --tags "$(tags)"'
env:
BUILD_REPOSITORY_LOCALPATH: $(System.DefaultWorkingDirectory)
- task: Bash@3
- script: |
scripts/linux/buildManifest.sh \
-r "$(to.registry.address)" \
-i "azureiotedge-hub" \
-v "$(resources.pipeline.images.runName)" \
-n "$(to.registry.namespace)" \
--tags '$(tags)'
displayName: 'Publish Edge Hub Manifest'
inputs:
targetType: filePath
filePath: '$(System.DefaultWorkingDirectory)/scripts/linux/buildManifest.sh'
arguments: '-r "$(to.registry.address)" -v "$(resources.pipeline.images.runName)" -t $(System.DefaultWorkingDirectory)/edge-hub/docker/manifest.yaml.template -n "$(to.registry.namespace)" --tags "$(tags)"'
env:
BUILD_REPOSITORY_LOCALPATH: $(System.DefaultWorkingDirectory)
- task: Bash@3
- script: |
scripts/linux/buildManifest.sh \
-r "$(to.registry.address)" \
-i "azureiotedge-simulated-temperature-sensor" \
-v "$(resources.pipeline.images.runName)" \
-n "$(to.registry.namespace)" \
--tags '$(tempSensor.tags)'
displayName: 'Publish Temperature Sensor Manifest'
inputs:
targetType: filePath
filePath: '$(System.DefaultWorkingDirectory)/scripts/linux/buildManifest.sh'
arguments: '-r "$(to.registry.address)" -v "$(resources.pipeline.images.runName)" -t $(System.DefaultWorkingDirectory)/edge-modules/SimulatedTemperatureSensor/docker/manifest.yaml.template -n "$(to.registry.namespace)" --tags "$(tempSensor.tags)"'
env:
BUILD_REPOSITORY_LOCALPATH: $(System.DefaultWorkingDirectory)
- task: Bash@3
- script: |
scripts/linux/buildManifest.sh \
-r "$(to.registry.address)" \
-i "azureiotedge-diagnostics" \
-v "$(resources.pipeline.images.runName)" \
-n "$(to.unlisted.registry.namespace)" \
--tags '$(tags)'
displayName: 'Publish Diagnostic Module Manifest'
inputs:
targetType: filePath
filePath: '$(System.DefaultWorkingDirectory)/scripts/linux/buildManifest.sh'
arguments: '-r "$(to.registry.address)" -v "$(resources.pipeline.images.runName)" -t $(System.DefaultWorkingDirectory)/edge-modules/iotedge-diagnostics-dotnet/docker/manifest.yaml.template -n "$(to.unlisted.registry.namespace)" --tags "$(tags)"'
env:
BUILD_REPOSITORY_LOCALPATH: $(System.DefaultWorkingDirectory)

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

@ -376,7 +376,6 @@ stages:
name: "Edge Hub"
project: Microsoft.Azure.Devices.Edge.Hub.Service
version: $(version)
bin_dir: '$(Build.BinariesDirectory)'
use_rocksdb: true
- job: BuildImageEdgeAgent
steps:
@ -386,7 +385,6 @@ stages:
name: "Edge Agent"
project: Microsoft.Azure.Devices.Edge.Agent.Service
version: $(version)
bin_dir: '$(Build.BinariesDirectory)'
use_rocksdb: true
- job: BuildImageTemperatureSensor
steps:
@ -396,7 +394,6 @@ stages:
name: "Temperature Sensor"
project: SimulatedTemperatureSensor
version: $(version)
bin_dir: '$(Build.BinariesDirectory)'
- job: BuildImageDiagnostics
steps:
- template: templates/image-linux.yaml
@ -405,7 +402,6 @@ stages:
name: "Diagnostics Module"
project: IotedgeDiagnosticsDotnet
version: $(version)
bin_dir: '$(Build.BinariesDirectory)'
################################################################################
- stage: PublishManifests
@ -422,13 +418,13 @@ stages:
strategy:
matrix:
EdgeAgent:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-agent/docker/manifest.yaml.template'
imageName: 'azureiotedge-agent'
EdgeHub:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-hub/docker/manifest.yaml.template'
imageName: 'azureiotedge-hub'
SimulatedTemperatureSensor:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-modules/SimulatedTemperatureSensor/docker/manifest.yaml.template'
imageName: 'azureiotedge-simulated-temperature-sensor'
Diagnostics:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-modules/iotedge-diagnostics-dotnet/docker/manifest.yaml.template'
imageName: 'azureiotedge-diagnostics'
steps:
# Both docker logins needed for if we need to test this job. In this case images should go to edgebuilds.
- task: Docker@2
@ -441,4 +437,11 @@ stages:
inputs:
command: login
containerRegistry: iotedge-release-acr
- script: scripts/linux/buildManifest.sh -r $(registry.address) -v $(version) -t $(manifestFilePath) -n '$(namespace)' --tags "$(tags)"
- script: |
scripts/linux/buildManifest.sh \
-r $(registry.address) \
-i $(imageName) \
-v $(version) \
-n '$(namespace)' \
--tags '$(tags)'
displayName: Create manifest for '$(imageName)'

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

@ -1,9 +1,7 @@
parameters:
name: 'API proxy'
imageName: 'api-proxy-module'
project: 'api-proxy-module'
configuration: 'release'
filePath: 'scripts/linux/buildAPIProxy.sh'
binDir: '$(Build.BinariesDirectory)'
jobs:
@ -19,18 +17,13 @@ jobs:
arm64:
arch: "aarch64"
steps:
- bash: |
sudo apt-get update && sudo apt-get -y install qemu binfmt-support qemu-user-static && \
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && \
docker buildx rm mbuilder || true && \
docker buildx create --name mbuilder || true && \
docker buildx use mbuilder
docker -v
- task: Bash@3
- script: |
scripts/linux/buildAPIProxy.sh \
-P ${{ parameters.project }} \
-c ${{ parameters.configuration }} \
--target-arch $(arch) \
--bin-dir ${{ parameters.binDir }}
displayName: Build API-Proxy - $(arch)
inputs:
filePath: ${{ parameters.filePath }}
arguments: -i ${{ parameters.imageName }} -P ${{ parameters.project }} -c ${{ parameters.configuration }} --target-arch $(arch) --bin-dir ${{ parameters.binDir }}
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '${{ parameters.binDir }}/publish'

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

@ -157,11 +157,11 @@ stages:
steps:
- template: image-linux.yaml
parameters:
name: Edge Agent
imageName: azureiotedge-agent
project: Microsoft.Azure.Devices.Edge.Agent.Service
bin_dir: '$(Build.BinariesDirectory)'
use_rocksdb: true
name: Edge Agent
imageName: azureiotedge-agent
project: Microsoft.Azure.Devices.Edge.Agent.Service
version: $(Build.BuildNumber)
use_rocksdb: true
- job: BuildImageEdgeHub
steps:
@ -170,7 +170,7 @@ stages:
name: Edge Hub
imageName: azureiotedge-hub
project: Microsoft.Azure.Devices.Edge.Hub.Service
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
use_rocksdb: true
- job: BuildImageTemperatureSensor
@ -180,7 +180,7 @@ stages:
name: Temperature Sensor
imageName: azureiotedge-simulated-temperature-sensor
project: SimulatedTemperatureSensor
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageDiagnostics
steps:
@ -189,7 +189,7 @@ stages:
name: Diagnostics
imageName: azureiotedge-diagnostics
project: IotedgeDiagnosticsDotnet
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageTemperatureFilter
steps:
@ -198,7 +198,7 @@ stages:
name: Temperature Filter
imageName: azureiotedge-temperature-filter
project: TemperatureFilter
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageLoadGen
steps:
@ -207,7 +207,8 @@ stages:
name: Load Gen
imageName: azureiotedge-load-gen
project: load-gen
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageTestAnalyzer
steps:
- template: image-linux.yaml
@ -215,7 +216,7 @@ stages:
name: Test Analyzer
imageName: azureiotedge-analyzer
project: TestAnalyzer
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
use_rocksdb: true
# Functions Sample - Not supported on linux arm64
@ -226,7 +227,7 @@ stages:
name: Functions Sample
imageName: azureiotedge-functions-filter
project: EdgeHubTriggerCSharp
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageDirectMethodSender
steps:
@ -235,7 +236,7 @@ stages:
name: Direct Method Sender
imageName: azureiotedge-direct-method-sender
project: DirectMethodSender
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageDirectMethodReceiver
steps:
@ -244,7 +245,7 @@ stages:
name: Direct Method Receiver
imageName: azureiotedge-direct-method-receiver
project: DirectMethodReceiver
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageMetricsValidator
steps:
@ -253,7 +254,7 @@ stages:
name: Metrics Validator
imageName: azureiotedge-metrics-validator
project: MetricsValidator
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageNumberLogger
steps:
@ -262,7 +263,7 @@ stages:
name: Number Logger
imageName: azureiotedge-number-logger
project: NumberLogger
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageModuleRestarter
steps:
@ -271,7 +272,7 @@ stages:
name: Module Restarter
imageName: azureiotedge-module-restarter
project: ModuleRestarter
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageTwinTester
steps:
@ -280,8 +281,9 @@ stages:
name: TwinTester
imageName: azureiotedge-twin-tester
project: TwinTester
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
use_rocksdb: true
- job: BuildImageRelayer
steps:
- template: image-linux.yaml
@ -289,7 +291,7 @@ stages:
name: Relayer
imageName: azureiotedge-relayer
project: Relayer
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageNetworkController
steps:
@ -298,7 +300,7 @@ stages:
name: Network Controller
imageName: azureiotedge-network-controller
project: NetworkController
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
use_rocksdb: true
- job: BuildImageTestResultCoordinator
@ -308,7 +310,7 @@ stages:
name: TestResultCoordinator
imageName: azureiotedge-test-result-coordinator
project: TestResultCoordinator
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
use_rocksdb: true
- job: BuildImageTestMetricsCollector
@ -318,8 +320,7 @@ stages:
name: Test Metrics Collector
imageName: azureiotedge-test-metrics-collector
project: TestMetricsCollector
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageDeploymentTester
steps:
@ -328,8 +329,7 @@ stages:
name: DeploymentTester
imageName: azureiotedge-deployment-tester
project: DeploymentTester
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageEdgeHubRestartTester
steps:
@ -338,7 +338,7 @@ stages:
name: EdgeHubRestartTester
imageName: azureiotedge-edgehub-restart-tester
project: EdgeHubRestartTester
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageCloudToDeviceMessageTester
steps:
@ -347,7 +347,7 @@ stages:
name: Cloud To Device Message Tester
imageName: azureiotedge-c2dmessage-tester
project: CloudToDeviceMessageTester
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageMetricsCollector
steps:
@ -356,19 +356,16 @@ stages:
name: Metrics Collector
imageName: azureiotedge-metrics-collector
project: Microsoft.Azure.Devices.Edge.Azure.Monitor
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
- job: BuildImageApiProxy
steps:
- bash: |
sudo apt-get update && sudo apt-get -y install qemu binfmt-support qemu-user-static && \
docker -v
- template: image-linux.yaml
parameters:
name: API Proxy
imageName: azureiotedge-api-proxy
project: api-proxy-module
bin_dir: '$(Build.BinariesDirectory)'
version: $(Build.BuildNumber)
################################################################################
- stage: PublishManifests
@ -380,24 +377,24 @@ stages:
- ImageOverride -equals agent-aziotedge-ubuntu-20.04-docker
dependsOn: BuildImages
variables:
tags: "['latest']"
tags: '["latest"]'
jobs:
- job: PublishManifest
displayName: Publish Manifest
strategy:
matrix:
EdgeAgent:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-agent/docker/manifest.yaml.template'
imageName: 'azureiotedge-agent'
EdgeHub:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-hub/docker/manifest.yaml.template'
imageName: 'azureiotedge-hub'
SimulatedTemperatureSensor:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-modules/SimulatedTemperatureSensor/docker/manifest.yaml.template'
imageName: 'azureiotedge-simulated-temperature-sensor'
Diagnostics:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-modules/iotedge-diagnostics-dotnet/docker/manifest.yaml.template'
imageName: 'azureiotedge-diagnostics'
MetricsCollector:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-modules/metrics-collector/docker/manifest.yaml.template'
imageName: 'azureiotedge-metrics-collector'
ApiProxy:
manifestFilePath: '$(System.DefaultWorkingDirectory)/edge-modules/api-proxy-module/docker/manifest.yaml.template'
imageName: 'azureiotedge-api-proxy'
steps:
- task: Docker@2
displayName: Docker login edgebuilds
@ -405,7 +402,14 @@ stages:
command: login
containerRegistry: iotedge-edgebuilds-acr
- script: scripts/linux/buildManifest.sh -r $(registry.address) -v $(Build.BuildNumber) -t $(manifestFilePath) -n microsoft --tags "$(tags)"
- script: |
scripts/linux/buildManifest.sh \
-r $(registry.address) \
-i $(imageName) \
-v $(Build.BuildNumber) \
-n 'microsoft' \
--tags '$(tags)'
displayName: Create manifest for '$(imageName)'
- job: ComponentGovernance
steps:

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

@ -7,17 +7,14 @@ jobs:
pool_name: $(pool.linux.name)
agent_image: agent-aziotedge-ubuntu-20.04-docker
arch: amd64
postfix: amd64
arm32:
pool_name: $(pool.linux.arm.name)
agent_image: agent-aziotedge-ubuntu-20.04-arm64-docker
arch: arm32v7
postfix: armhf
arm64:
pool_name: $(pool.linux.arm.name)
agent_image: agent-aziotedge-ubuntu-20.04-arm64-docker
arch: arm64v8
postfix: arm64
pool:
name: $(pool_name)
demands:
@ -29,7 +26,6 @@ jobs:
/usr/bin/newgrp docker <<EONG
scripts/linux/buildRocksDb.sh \
--output-dir $(Build.ArtifactStagingDirectory) \
--postfix $(postfix) \
--build-number $(Build.BuildNumber) \
--arch $(arch) \
--source-map /etc/iotedge-source-map.json

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

@ -7,7 +7,7 @@ parameters:
bin_dir: '$(Build.BinariesDirectory)'
use_rocksdb: false
download_artifacts: true
manifestTemplate: ''
buildManifest: false
steps:
- task: DownloadBuildArtifacts@0
@ -56,7 +56,8 @@ steps:
-P "${{ parameters.project }}" \
-v "${{ parameters.version }}" \
--bin-dir "${{ parameters.bin_dir }}" \
--source-map /etc/iotedge-source-map.json
--source-map '/etc/iotedge-source-map.json' \
-t 'amd64'
displayName: Build Image - ${{ parameters.name }} - amd64
- script: |
@ -66,10 +67,10 @@ steps:
-n "${{ parameters.namespace }}" \
-P "${{ parameters.project }}" \
-v "${{ parameters.version }}" \
--target-arch armv7l \
--bin-dir "${{ parameters.bin_dir }}" \
--source-map /etc/iotedge-source-map.json
displayName: Build Image - ${{ parameters.name }} - arm32
--source-map '/etc/iotedge-source-map.json' \
-t 'arm/v7'
displayName: Build Image - ${{ parameters.name }} - arm/v7
condition: and(ne('${{ parameters.name }}', 'Functions Sample'), succeeded())
- script: |
@ -79,18 +80,18 @@ steps:
-n "${{ parameters.namespace }}" \
-P "${{ parameters.project }}" \
-v "${{ parameters.version }}" \
--target-arch aarch64 \
--bin-dir "${{ parameters.bin_dir }}" \
--source-map /etc/iotedge-source-map.json
--source-map '/etc/iotedge-source-map.json' \
-t 'arm64'
displayName: Build Image - ${{ parameters.name }} - arm64
condition: and(ne('${{ parameters.name }}', 'Functions Sample'), succeeded())
- script: |
scripts/linux/buildManifest.sh \
-r '$(registry.address)' \
-i '${{ parameters.imageName }}' \
-n '${{ parameters.namespace }}' \
-t '${{ parameters.manifestTemplate }}' \
-v '${{ parameters.version }}' \
--tags '$(tags)'
displayName: Build Image Manifest - ${{ parameters.name }}
condition: and(ne('${{ parameters.manifestTemplate }}', ''), succeeded())
condition: and(${{ parameters.buildManifest }}, succeeded())

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

@ -90,8 +90,8 @@ jobs:
- script: |
scripts/linux/buildManifest.sh \
-r $(registry.address) \
-i 'azureiotedge-metrics-collector' \
-v $(version) \
-t $(System.DefaultWorkingDirectory)/edge-modules/metrics-collector/docker/manifest.yaml.template \
-n public \
-n 'public' \
--tags '$(tags)'
displayName: 'Publish Manifest'

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

@ -107,9 +107,9 @@ jobs:
- script: |
scripts/linux/buildManifest.sh \
-r '$(registry.address)' \
-i 'azureiotedge-metrics-collector' \
-v '$(version)' \
-t 'edge-modules/metrics-collector/docker/manifest.yaml.template' \
-n microsoft \
-n 'microsoft' \
--tags '$(tags)'
displayName: Build Manifest

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

@ -383,7 +383,7 @@ stages:
project: Microsoft.Azure.Devices.Edge.Agent.Service
version: $(version)
use_rocksdb: true
manifestTemplate: 'edge-agent/docker/manifest.yaml.template'
buildManifest: true
- job: EdgeHub
displayName: Edge Hub
@ -395,7 +395,7 @@ stages:
project: Microsoft.Azure.Devices.Edge.Hub.Service
version: $(version)
use_rocksdb: true
manifestTemplate: 'edge-hub/docker/manifest.yaml.template'
buildManifest: true
- job: TemperatureSensor
displayName: Temperature sensor
@ -406,7 +406,7 @@ stages:
name: "Temperature Sensor"
project: SimulatedTemperatureSensor
version: $(version)
manifestTemplate: 'edge-modules/SimulatedTemperatureSensor/docker/manifest.yaml.template'
buildManifest: true
- job: Diagnostics
displayName: Diagnostics
@ -417,7 +417,7 @@ stages:
name: "Diagnostics Module"
project: IotedgeDiagnosticsDotnet
version: $(diagnostics_version)
manifestTemplate: 'edge-modules/iotedge-diagnostics-dotnet/docker/manifest.yaml.template'
buildManifest: true
# for E2E tests
- job: MetricsCollector
@ -428,6 +428,7 @@ stages:
name: Metrics Collector
imageName: azureiotedge-metrics-collector
project: Microsoft.Azure.Devices.Edge.Azure.Monitor
version: $(Build.BuildNumber)
- job: MetricsValidator
displayName: Metrics validator
@ -437,6 +438,7 @@ stages:
name: Metrics Validator
imageName: azureiotedge-metrics-validator
project: MetricsValidator
version: $(Build.BuildNumber)
- job: DirectMethodSender
displayName: Direct method sender
@ -446,6 +448,7 @@ stages:
name: Direct Method Sender
imageName: azureiotedge-direct-method-sender
project: DirectMethodSender
version: $(Build.BuildNumber)
- job: DirectMethodReceiver
displayName: Direct method receiver
@ -455,6 +458,7 @@ stages:
name: Direct Method Receiver
imageName: azureiotedge-direct-method-receiver
project: DirectMethodReceiver
version: $(Build.BuildNumber)
- job: NumberLogger
displayName: Number logger
@ -464,6 +468,7 @@ stages:
name: Number Logger
imageName: azureiotedge-number-logger
project: NumberLogger
version: $(Build.BuildNumber)
- job: TemperatureFilter
displayName: Temperature filter
@ -473,6 +478,7 @@ stages:
name: Temperature Filter
imageName: azureiotedge-temperature-filter
project: TemperatureFilter
version: $(Build.BuildNumber)
- job: LoadGen
displayName: Load gen
@ -482,6 +488,7 @@ stages:
name: Load Gen
imageName: azureiotedge-load-gen
project: load-gen
version: $(Build.BuildNumber)
- job: TestResultCoordinator
displayName: Test result coordinator
@ -491,6 +498,7 @@ stages:
name: TestResultCoordinator
imageName: azureiotedge-test-result-coordinator
project: TestResultCoordinator
version: $(Build.BuildNumber)
use_rocksdb: true
- job: Relayer
@ -501,8 +509,9 @@ stages:
name: Relayer
imageName: azureiotedge-relayer
project: Relayer
version: $(Build.BuildNumber)
# Functions Sample - Not supported on linux arm64
# Functions Sample - Only supported on amd64
- job: FunctionsSample
displayName: Functions sample
steps:
@ -511,6 +520,7 @@ stages:
name: Functions Sample
imageName: azureiotedge-functions-filter
project: EdgeHubTriggerCSharp
version: $(Build.BuildNumber)
################################################################################
- stage: TestImages

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

@ -246,7 +246,7 @@ stages:
project: Microsoft.Azure.Devices.Edge.Azure.Monitor
version: $(version)
download_artifacts: false
manifestTemplate: 'edge-modules/metrics-collector/docker/manifest.yaml.template'
buildManifest: true
################################################################################
- stage: Test
@ -496,9 +496,9 @@ stages:
- script: |
scripts/linux/buildManifest.sh \
-r '$(registry.address)' \
-i 'azureiotedge-metrics-collector' \
-v $(version) \
-t edge-modules/metrics-collector/docker/manifest.yaml.template \
-n public \
-n 'public' \
--tags '$(tags)'
displayName: Publish Manifest
workingDirectory: iotedge

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

@ -54,9 +54,9 @@ jobs:
- script: |
scripts/linux/buildManifest.sh \
-r '$(registry.address)' \
-i 'azureiotedge-agent' \
-v '${{ parameters['version.core'] }}' \
-t 'edge-agent/docker/manifest.yaml.template' \
-n public \
-n 'public' \
--tags '${{ parameters.tags }}'
displayName: Publish Edge Agent manifest
workingDirectory: iotedge
@ -64,9 +64,9 @@ jobs:
- script: |
scripts/linux/buildManifest.sh \
-r '$(registry.address)' \
-i 'azureiotedge-hub' \
-v '${{ parameters['version.core'] }}' \
-t 'edge-hub/docker/manifest.yaml.template' \
-n public \
-n 'public' \
--tags '${{ parameters.tags }}'
displayName: Publish Edge Hub manifest
workingDirectory: iotedge
@ -75,9 +75,9 @@ jobs:
tempsensor_tags=$(echo '${{ parameters.tags }}' | jq -c '. + ["latest"]')
scripts/linux/buildManifest.sh \
-r '$(registry.address)' \
-i 'azureiotedge-simulated-temperature-sensor' \
-v '${{ parameters['version.core'] }}' \
-t 'edge-modules/SimulatedTemperatureSensor/docker/manifest.yaml.template' \
-n public \
-n 'public' \
--tags "$tempsensor_tags"
displayName: Publish Temperature Sensor manifest
workingDirectory: iotedge
@ -85,9 +85,9 @@ jobs:
- script: |
scripts/linux/buildManifest.sh \
-r '$(registry.address)' \
-i 'azureiotedge-diagnostics' \
-v '${{ parameters['version.diagnostics'] }}' \
-t 'edge-modules/iotedge-diagnostics-dotnet/docker/manifest.yaml.template' \
-n unlisted \
-n 'unlisted' \
--tags '${{ parameters.tags }}'
displayName: Publish Diagnostics manifest
workingDirectory: iotedge

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

@ -105,20 +105,8 @@ Sometimes it is useful to build the Edge Hub container locally. If you want to d
## Build Manifest Image
There is a script in the repo to build multi-architecture images.
This script assumes that the platform specific images are already in the docker registry.
Usage is as follows:
```sh
$ scripts/linux/buildManifest.sh --help
Call `scripts/linux/buildManifest.sh --help` for more information.
buildManifest.sh [options]
Note: Depending on the options you might have to run this as root or sudo.
options
-r, --registry Docker registry required to build, tag and run the module
-u, --username Docker Registry Username
-p, --password Docker Username's password
-v, --image-version Docker Image Version.
-t, --template Yaml file template for manifest definition.
```
## Attach the VSCode Debugger to EdgeAgent
There is a script in the repo to setup a docker container with the Visual Studio Debugger (vsdbg). After running the script in a container, you can connect the VSCode debugger to a process running in the container. The following example shows how to run the setup script on a Linux IoT Edge device to setup the debugger in the Edge Agent container:

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

@ -3,13 +3,14 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
ARG TARGETPLATFORM
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.amd64 /usr/local/lib/librocksdb.so
COPY $EXE_DIR/librocksdb/$TARGETPLATFORM/librocksdb.so /usr/local/lib/librocksdb.so
WORKDIR /app

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.armhf /usr/local/lib/librocksdb.so
WORKDIR /app
COPY $EXE_DIR/ ./
CMD exec /app/agentStart.sh

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.arm64 /usr/local/lib/librocksdb.so
WORKDIR /app
COPY $EXE_DIR/ ./
CMD exec /app/agentStart.sh

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

@ -1,18 +0,0 @@
image: __REGISTRY__/__NAMESPACE__/azureiotedge-agent:__VERSION__
tags: __TAGS__
manifests:
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-agent:__VERSION__-linux-amd64
platform:
architecture: amd64
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-agent:__VERSION__-linux-arm64v8
platform:
architecture: arm64
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-agent:__VERSION__-linux-arm32v7
platform:
architecture: arm
os: linux

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

@ -1,5 +1,10 @@
#!/bin/sh
if [[ "$TARGETARCH" == 'arm' ]] || [[ "$TARGETARCH" == 'arm64' ]]; then
export OptimizeForPerformance=false
export MqttEventsProcessorThreadCount=1
fi
###############################################################################
# Set up EdgeHub to run as a non-root user at runtime, if allowed.
#

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

@ -3,6 +3,7 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
ARG TARGETPLATFORM
# RocksDB requires snappy
RUN apk update && \
@ -13,7 +14,7 @@ RUN apk update && \
RUN setcap 'cap_net_bind_service=+ep' /usr/share/dotnet/dotnet
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.amd64 /usr/local/lib/librocksdb.so
COPY $EXE_DIR/librocksdb/$TARGETPLATFORM/librocksdb.so /usr/local/lib/librocksdb.so
WORKDIR /app

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

@ -1,32 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy libcap
# Add the CAP_NET_BIND_SERVICE capability to the dotnet binary because
# we are starting Edge Hub as a non-root user
RUN setcap 'cap_net_bind_service=+ep' /usr/share/dotnet/dotnet
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.armhf /usr/local/lib/librocksdb.so
WORKDIR /app
COPY $EXE_DIR/ ./
# Expose MQTT, AMQP and HTTPS ports
EXPOSE 1883/tcp
EXPOSE 8883/tcp
EXPOSE 5671/tcp
EXPOSE 443/tcp
ENV OptimizeForPerformance false
ENV MqttEventsProcessorThreadCount 1
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Edge Hub" && \
exec /app/hubStart.sh

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

@ -1,32 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy libcap
# Add the CAP_NET_BIND_SERVICE capability to the dotnet binary because
# we are starting Edge Hub as a non-root user
RUN setcap 'cap_net_bind_service=+ep' /usr/share/dotnet/dotnet
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.arm64 /usr/local/lib/librocksdb.so
WORKDIR /app
COPY $EXE_DIR/ ./
# Expose MQTT, AMQP and HTTPS ports
EXPOSE 1883/tcp
EXPOSE 8883/tcp
EXPOSE 5671/tcp
EXPOSE 443/tcp
ENV OptimizeForPerformance false
ENV MqttEventsProcessorThreadCount 1
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Edge Hub" && \
exec /app/hubStart.sh

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

@ -1,18 +0,0 @@
image: __REGISTRY__/__NAMESPACE__/azureiotedge-hub:__VERSION__
tags: __TAGS__
manifests:
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-hub:__VERSION__-linux-amd64
platform:
architecture: amd64
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-hub:__VERSION__-linux-arm32v7
platform:
architecture: arm
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-hub:__VERSION__-linux-arm64v8
platform:
architecture: arm64
os: linux

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "SimulatedTemperatureSensor.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"[%Y-%m-%d %H:%M:%S %:z]"): Starting Module" && \
exec /usr/bin/dotnet SimulatedTemperatureSensor.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "SimulatedTemperatureSensor.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"[%Y-%m-%d %H:%M:%S %:z]"): Starting Module" && \
exec /usr/bin/dotnet SimulatedTemperatureSensor.dll

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

@ -1,18 +0,0 @@
image: __REGISTRY__/__NAMESPACE__/azureiotedge-simulated-temperature-sensor:__VERSION__
tags: __TAGS__
manifests:
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-simulated-temperature-sensor:__VERSION__-linux-amd64
platform:
architecture: amd64
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-simulated-temperature-sensor:__VERSION__-linux-arm32v7
platform:
architecture: arm
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-simulated-temperature-sensor:__VERSION__-linux-arm64v8
platform:
architecture: arm64
os: linux

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

@ -1,18 +0,0 @@
image: __REGISTRY__/__NAMESPACE__/azureiotedge-api-proxy:__VERSION__
tags: __TAGS__
manifests:
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-api-proxy:__VERSION__-linux-amd64
platform:
architecture: amd64
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-api-proxy:__VERSION__-linux-arm32v7
platform:
architecture: arm
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-api-proxy:__VERSION__-linux-arm64v8
platform:
architecture: arm64
os: linux

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

@ -1,13 +0,0 @@
image: __REGISTRY__/__NAMESPACE__/azureiotedge-functions-binding:__VERSION__
tags: __TAGS__
manifests:
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-functions-binding:__VERSION__-linux-amd64
platform:
architecture: amd64
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-functions-binding:__VERSION__-linux-arm32v7
platform:
architecture: arm
os: linux

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

@ -1,12 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
WORKDIR /app
COPY $EXE_DIR/ ./
CMD echo "$(date --utc +"[%Y-%m-%d %H:%M:%S %:z]"): Module is intended to be used with docker run command"

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

@ -1,12 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
WORKDIR /app
COPY $EXE_DIR/ ./
CMD echo "$(date --utc +"[%Y-%m-%d %H:%M:%S %:z]"): Module is intended to be used with docker run command"

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

@ -1,18 +0,0 @@
image: __REGISTRY__/__NAMESPACE__/azureiotedge-diagnostics:__VERSION__
tags: __TAGS__
manifests:
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-diagnostics:__VERSION__-linux-amd64
platform:
architecture: amd64
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-diagnostics:__VERSION__-linux-arm32v7
platform:
architecture: arm
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-diagnostics:__VERSION__-linux-arm64v8
platform:
architecture: arm64
os: linux

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "Microsoft.Azure.Devices.Edge.Azure.Monitor.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"[%Y-%m-%d %H:%M:%S %:z]"): Starting Module" && \
exec /usr/bin/dotnet Microsoft.Azure.Devices.Edge.Azure.Monitor.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "Microsoft.Azure.Devices.Edge.Azure.Monitor.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"[%Y-%m-%d %H:%M:%S %:z]"): Starting Module" && \
exec /usr/bin/dotnet Microsoft.Azure.Devices.Edge.Azure.Monitor.dll

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

@ -1,18 +0,0 @@
image: __REGISTRY__/__NAMESPACE__/azureiotedge-metrics-collector:__VERSION__
tags: __TAGS__
manifests:
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-metrics-collector:__VERSION__-linux-amd64
platform:
architecture: amd64
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-metrics-collector:__VERSION__-linux-arm32v7
platform:
architecture: arm
os: linux
-
image: __REGISTRY__/__NAMESPACE__/azureiotedge-metrics-collector:__VERSION__-linux-arm64v8
platform:
architecture: arm64
os: linux

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

@ -3,6 +3,7 @@
FROM alpine:3.14
ARG num_procs=4
ARG TARGETPLATFORM
# Build RocksDB for alpine
RUN apk update && \
@ -14,5 +15,5 @@ RUN git clone -b v5.17.2 --depth 1 https://github.com/facebook/rocksdb.git && \
PORTABLE=1 \
make -j ${num_procs} shared_lib && \
strip librocksdb.so && \
mkdir -p ../publish && \
cp -vL ./librocksdb.so ../publish/librocksdb.so.amd64
mkdir -p ../publish/$TARGETPLATFORM && \
cp -vL ./librocksdb.so ../publish/$TARGETPLATFORM/

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM alpine:3.14
ARG num_procs=4
# Build RocksDB for alpine
RUN apk update && \
apk add build-base bash perl linux-headers coreutils git snappy-dev
RUN git clone -b v5.17.2 --depth 1 https://github.com/facebook/rocksdb.git && \
cd rocksdb && \
CFLAGS='-static-libstdc++ -Wno-psabi -Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=redundant-move -DSNAPPY' \
PORTABLE=1 \
make -j ${num_procs} shared_lib && \
strip librocksdb.so && \
mkdir -p ../publish && \
cp -vL ./librocksdb.so ../publish/librocksdb.so.armhf

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM alpine:3.14
ARG num_procs=4
# Build RocksDB for alpine
RUN apk update && \
apk add build-base bash perl linux-headers coreutils git snappy-dev
RUN git clone -b v5.17.2 --depth 1 https://github.com/facebook/rocksdb.git && \
cd rocksdb && \
CFLAGS='-static-libstdc++ -Wno-psabi -Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=redundant-move -DSNAPPY' \
PORTABLE=1 \
make -j ${num_procs} shared_lib && \
strip librocksdb.so && \
mkdir -p ../publish && \
cp -vL ./librocksdb.so ../publish/librocksdb.so.arm64

56
scripts/linux/buildAPIProxy.sh Normal file → Executable file
Просмотреть файл

@ -4,7 +4,7 @@
# This script builds a static binary of the api-proxy-module
###############################################################################
set -e
set -euo pipefail
###############################################################################
# Define Environment Variables
@ -16,9 +16,9 @@ TARGET=
SCRIPT_NAME=$(basename "$0")
PROJECT=
DOCKERFILE=
DOCKER_IMAGENAME=
BUILD_BINARIESDIRECTORY=${BUILD_BINARIESDIRECTORY:-$BUILD_REPOSITORY_LOCALPATH}
PUBLISH_DIR=${BUILD_BINARIESDIRECTORY}/publish
BUILD_BINARIESDIRECTORY=
PUBLISH_DIR=
BUILD_REPOSITORY_LOCALPATH=${BUILD_REPOSITORY_LOCALPATH:-$DIR/../..}
API_PROXY_DIR=${BUILD_REPOSITORY_LOCALPATH}/edge-modules/api-proxy-module
BUILD_CONFIGURATION="release"
BUILD_CONFIG_OPTION=
@ -28,16 +28,12 @@ BUILD_CONFIG_OPTION=
###############################################################################
check_arch()
{
if [[ "$ARCH" == "x86_64" ]]; then
ARCH="amd64"
elif [[ "$ARCH" == "armv7l" ]]; then
ARCH="arm32v7"
elif [[ "$ARCH" == "aarch64" ]]; then
ARCH="arm64v8"
else
echo "Unsupported architecture $ARCH"
exit 1
fi
case "$ARCH" in
'amd64'|'x86_64') ARCH='amd64' ;;
'arm32v7'|'armv7l') ARCH='arm32v7' ;;
'arm64v8'|'aarch64') ARCH='arm64v8' ;;
*) echo "Unsupported architecture '$ARCH'" && exit 1 ;;
esac
}
###############################################################################
@ -46,11 +42,13 @@ check_arch()
function usage()
{
echo "$SCRIPT_NAME [options]"
echo ""
echo "options"
echo " -h, --help Print this help and exit."
echo " -i, --image Image name"
echo " -t, --target-arch Target architecture: amd64|arm32v7|aarch64"
echo ''
echo 'options'
echo ' -h, --help Print this help and exit.'
echo ' -t, --target-arch Target architecture: amd64|arm32v7|aarch64'
echo ' -P, --project Project name'
echo ' -c, --configuration release or debug'
echo ' --bin-dir Output directory'
exit 1;
}
@ -65,8 +63,8 @@ print_args()
echo "Project: $API_PROXY_DIR"
echo "Arch: $ARCH"
echo "Target: $TARGET"
echo "Image: $DOCKER_IMAGENAME"
echo "Dockerfile: $DOCKERFILE"
echo "Output: $PUBLISH_DIR"
echo
}
@ -87,12 +85,9 @@ process_args()
PROJECT="$arg"
save_next_arg=0
elif [[ ${save_next_arg} -eq 3 ]]; then
DOCKER_IMAGENAME="$arg"
save_next_arg=0
elif [[ ${save_next_arg} -eq 4 ]]; then
BUILD_CONFIGURATION="$arg"
save_next_arg=0
elif [[ ${save_next_arg} -eq 5 ]]; then
elif [[ ${save_next_arg} -eq 4 ]]; then
BUILD_BINARIESDIRECTORY="$arg"
save_next_arg=0
else
@ -100,9 +95,8 @@ process_args()
"-h" | "--help" ) usage;;
"-t" | "--target-arch" ) save_next_arg=1;;
"-P" | "--project" ) save_next_arg=2;;
"-i" | "--image-name" ) save_next_arg=3;;
"-c" | "--configuration" ) save_next_arg=4;;
"--bin-dir" ) save_next_arg=5;;
"-c" | "--configuration" ) save_next_arg=3;;
"--bin-dir" ) save_next_arg=4;;
* ) usage;;
esac
fi
@ -114,10 +108,8 @@ process_args()
arm64v8) TARGET="aarch64-unknown-linux-gnu";;
esac
if [[ -z ${DOCKER_IMAGENAME} ]]; then
echo "Docker image name parameter invalid"
print_help_and_exit
fi
BUILD_BINARIESDIRECTORY=${BUILD_BINARIESDIRECTORY:-$BUILD_REPOSITORY_LOCALPATH}
PUBLISH_DIR=${BUILD_BINARIESDIRECTORY}/publish
if [[ ! -d ${BUILD_BINARIESDIRECTORY} ]]; then
mkdir "${BUILD_BINARIESDIRECTORY}"
@ -163,7 +155,7 @@ build_project()
execute cd "$API_PROXY_DIR"
# prepare docker folder
local EXE_DOCKER_DIR="$PUBLISH_DIR/$DOCKER_IMAGENAME/docker/linux/$ARCH"
local EXE_DOCKER_DIR="$PUBLISH_DIR/$PROJECT/docker/linux/$ARCH"
execute mkdir -p "$EXE_DOCKER_DIR"
# copy Dockerfile to publish folder for given arch

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

@ -18,25 +18,40 @@ PUBLISH_DIR=
PROJECT=
DOCKERFILE=
DOCKER_IMAGENAME=
DEFAULT_DOCKER_NAMESPACE="microsoft"
DEFAULT_DOCKER_NAMESPACE='microsoft'
DOCKER_NAMESPACE=${DEFAULT_DOCKER_NAMESPACE}
BUILD_BINARIESDIRECTORY=${BUILD_BINARIESDIRECTORY:=""}
SKIP_PUSH=0
SOURCE_MAP=
###############################################################################
# Function to obtain the underlying architecture and check if supported
# Check format and content of --target-arch argument
###############################################################################
check_arch() {
if [[ "$ARCH" == "x86_64" ]]; then
ARCH="amd64"
elif [[ "$ARCH" == "armv7l" ]]; then
ARCH="arm32v7"
elif [[ "$ARCH" == "aarch64" ]]; then
ARCH="arm64v8"
else
echo "Unsupported architecture"
exit 1
fi
case "$ARCH" in
'x86_64') ARCH='amd64' ;;
'armv7l') ARCH='arm/v7' ;;
'aarch64') ARCH='arm64' ;;
'amd64'|'arm64'|'arm/v7') ;;
*) echo "Unsupported architecture '$ARCH'" && exit 1 ;;
esac
}
###############################################################################
# Convert from the format of the --target-arch argument to the format we use in
# our image tags. Docker defines the former (amd64, arm64, or arm/v7; see
# Docker's TARGETARCH automatic variable[1]), we define the latter (amd64,
# arm64v8, and arm32v7).
# [1] https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
###############################################################################
convert_arch() {
arch="$1"
case "$arch" in
'amd64') echo 'amd64' ;;
'arm64') echo 'arm64v8' ;;
'arm/v7') echo 'arm32v7' ;;
*) echo "Unsupported architecture '$arch'" && exit 1 ;;
esac
}
###############################################################################
@ -52,7 +67,7 @@ usage() {
echo " -r, --registry Docker registry required to build, tag and run the module"
echo " -n, --namespace Docker namespace (default: $DEFAULT_DOCKER_NAMESPACE)"
echo " -v, --image-version Docker Image Version. Either use this option or set env variable BUILD_BUILDNUMBER"
echo " -t, --target-arch Target architecture (default: uname -m)"
echo " -t, --target-arch Target architecture (supported values are amd64, arm64, and arm/v7, default is host's architecture)"
echo "--bin-dir Directory containing the output binaries. Either use this option or set env variable BUILD_BINARIESDIRECTORY"
echo "--source-map Path to the JSON file that maps Dockerfile image sources to their replacements. Assumes the tool 'gnarly' is in the PATH"
echo "--skip-push Build images, but don't push them"
@ -69,7 +84,7 @@ print_help_and_exit() {
###############################################################################
process_args() {
save_next_arg=0
for arg in "$@"; do
for arg in $@; do
if [[ ${save_next_arg} -eq 1 ]]; then
DOCKER_REGISTRY="$arg"
save_next_arg=0
@ -107,63 +122,76 @@ process_args() {
"-i" | "--image-name") save_next_arg=7 ;;
"-n" | "--namespace") save_next_arg=8 ;;
"--skip-push") SKIP_PUSH=1 ;;
*) usage ;;
*) echo "Unknown argument '$arg'"; usage ;;
esac
fi
done
if [[ -z ${DOCKER_REGISTRY} ]]; then
echo "Registry parameter invalid"
if [[ -z "$DOCKER_REGISTRY" ]]; then
echo 'The --registry parameter is required'
print_help_and_exit
fi
if [[ -z ${DOCKER_IMAGENAME} ]]; then
echo "Docker image name parameter invalid"
if [[ -z "$DOCKER_IMAGENAME" ]]; then
echo 'The --image-name parameter is required'
print_help_and_exit
fi
if [[ -z ${DOCKER_IMAGEVERSION} ]]; then
if [[ -n "${BUILD_BUILDNUMBER}" ]]; then
DOCKER_IMAGEVERSION=${BUILD_BUILDNUMBER}
if [[ -z "$DOCKER_IMAGEVERSION" ]]; then
if [[ -n "$BUILD_BUILDNUMBER" ]]; then
DOCKER_IMAGEVERSION="$BUILD_BUILDNUMBER"
else
echo "Docker image version not found."
echo 'The --image-version parameter is required if BUILD_BUILDNUMBER is not set'
print_help_and_exit
fi
fi
if [[ -z ${BUILD_BINARIESDIRECTORY} ]] || [[ ! -d ${BUILD_BINARIESDIRECTORY} ]]; then
echo "Bin directory does not exist or is invalid"
if [[ -z "$BUILD_BINARIESDIRECTORY" ]]; then
echo 'The --bin-dir parameter is required if BUILD_BINARIESDIRECTORY is not set'
print_help_and_exit
fi
PUBLISH_DIR=${BUILD_BINARIESDIRECTORY}/publish
if [[ ! -d "$BUILD_BINARIESDIRECTORY" ]]; then
echo "Binaries dir '$BUILD_BINARIESDIRECTORY' not found"
print_help_and_exit
fi
if [[ ! -d ${PUBLISH_DIR} ]]; then
echo "Publish directory does not exist or is invalid"
PUBLISH_DIR="$BUILD_BINARIESDIRECTORY/publish"
if [[ ! -d "$PUBLISH_DIR" ]]; then
echo "$PUBLISH_DIR not found"
print_help_and_exit
fi
EXE_DOCKER_DIR=${PUBLISH_DIR}/${PROJECT}/docker
if [[ -z ${EXE_DOCKER_DIR} ]] || [[ ! -d ${EXE_DOCKER_DIR} ]]; then
echo "No docker directory for $PROJECT at $EXE_DOCKER_DIR"
if [[ ! -d "$EXE_DOCKER_DIR" ]]; then
echo "$EXE_DOCKER_DIR not found"
print_help_and_exit
fi
if [[ -n "$SOURCE_MAP" ]] && [[ ! -f "$SOURCE_MAP" ]]; then
echo "File specified by --source-map does not exist"
echo 'File specified by --source-map not found'
print_help_and_exit
fi
if [[ -n "$SOURCE_MAP" ]] && ! command -v gnarly > /dev/null; then
echo "--source-map specified, but required tool 'gnarly' not found in PATH"
echo '--source-map specified, but required tool 'gnarly' not found in PATH'
print_help_and_exit
fi
DOCKERFILE="$EXE_DOCKER_DIR/linux/$ARCH/Dockerfile"
if [[ ! -f ${DOCKERFILE} ]]; then
echo "No Dockerfile at $DOCKERFILE"
print_help_and_exit
dockerfile1="$EXE_DOCKER_DIR/linux/Dockerfile"
if [[ -f "$dockerfile1" ]]; then
DOCKERFILE="$dockerfile1"
else
arch=$(convert_arch $ARCH)
dockerfile2="$EXE_DOCKER_DIR/linux/$arch/Dockerfile"
if [[ -f "$dockerfile2" ]]; then
DOCKERFILE="$dockerfile2"
else
echo "No Dockerfile at '$dockerfile1' or '$dockerfile2'"
print_help_and_exit
fi
fi
}
@ -171,7 +199,7 @@ process_args() {
# Build docker image and push it to private repo
#
# @param[1] - imagename; Name of the docker edge image to publish; Required;
# @param[2] - arch; Arch of base image; Required;
# @param[2] - arch; Architectures to build; Required;
# @param[3] - dockerfile; Path to the dockerfile; Required;
# @param[4] - context_path; docker context path; Required;
# @param[5] - build_args; docker context path; Optional;
@ -183,28 +211,25 @@ docker_build_and_tag_and_push() {
dockerfile="$3"
context_path="$4"
build_args="$5"
build_context=''
if [[ -z "$imagename" ]] || [[ -z "$arch" ]] || [[ -z "$dockerfile" ]] || [[ -z "$context_path" ]]; then
echo "Error: Arguments are invalid [$imagename] [$arch] [$dockerfile] [$context_path]"
exit 1
fi
image="$DOCKER_REGISTRY/$DOCKER_NAMESPACE/$imagename:$DOCKER_IMAGEVERSION-linux-$arch"
case "$arch" in
'amd64') platform='linux/amd64' ;;
'arm32v7') platform='linux/arm/v7' ;;
'arm64v8') platform='linux/arm64' ;;
esac
docker buildx create --use --bootstrap
trap "docker buildx rm" EXIT
suffix=$(convert_arch $arch)
image="$DOCKER_REGISTRY/$DOCKER_NAMESPACE/$imagename:$DOCKER_IMAGEVERSION-linux-$suffix"
platform="linux/$arch"
if [[ ${SKIP_PUSH} -eq 0 ]]; then
attrs='type=image,push=true'
output_type='registry'
echo "Building and pushing image '$image'"
else
attrs='type=docker'
output_type='docker'
echo "Building image '$image', skipping push"
fi
@ -212,37 +237,21 @@ docker_build_and_tag_and_push() {
build_context=$(gnarly --mod-config $SOURCE_MAP $dockerfile)
fi
# When Docker introduced provenance attestation in buildx 0.10.0 it broke
# our multi-arch image builds. By default, `buildx build` now defaults to
# `--provenance true` which causes even single-architecture images to be
# built as a manifest list (aka multi-arch image). When we use our older
# manifest-tool to create a manifest from three single-arch images (amd64,
# arm32v7, and arm64v8), the tool fails because it can't create a manifest
# list that points to other manifest lists. To mitigate, we'll disable
# provenance attestation for now.
docker buildx build \
--no-cache \
--platform $platform \
--provenance false \
--build-arg 'EXE_DIR=.' \
$([ -z "$build_args" ] || echo $build_args) \
--file $dockerfile \
--output=$attrs,name=$image,buildinfo-attrs=true \
--output=type=$output_type,name=$image,buildinfo-attrs=true \
$([ -z "$build_context" ] || echo $build_context) \
$context_path
if [[ $? -ne 0 ]]; then
echo "Docker build failed with exit code $?"
exit 1
fi
return $?
}
###############################################################################
# Main Script Execution
###############################################################################
check_arch
process_args "$@"
process_args $@
build_args=("EXE_DIR=.")

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

@ -19,9 +19,9 @@ function usage() {
echo "$SCRIPT_NAME [options]"
echo ""
echo "options"
echo "--registry-address Path where to put librocksdb folder containing built artifact."
echo "--version Tag for built edge hub image."
echo " -h, --help Print this help and exit."
echo "--registry-address Docker registry where Edge Hub image will be published."
echo "--version Tag for built edge hub image."
echo " -h, --help Print this help and exit."
exit 1
}
@ -56,5 +56,5 @@ function process_args() {
process_args "$@"
scripts/linux/buildBranch.sh --no-rocksdb-bin
scripts/linux/buildRocksDb.sh --output-dir "$(pwd)/target/publish/Microsoft.Azure.Devices.Edge.Hub.Service" --postfix amd64 --build-number debug --arch amd64
scripts/linux/buildImage.sh -r "$REGISTRY_ADDRESS" -i azureiotedge-hub -n microsoft -P Microsoft.Azure.Devices.Edge.Hub.Service -v "$VERSION" --bin-dir target
scripts/linux/buildRocksDb.sh --output-dir "$(pwd)/target/publish/Microsoft.Azure.Devices.Edge.Hub.Service" --build-number debug --arch amd64
scripts/linux/buildImage.sh -r "$REGISTRY_ADDRESS" -i azureiotedge-hub -n microsoft -P Microsoft.Azure.Devices.Edge.Hub.Service -v "$VERSION" -t amd64 --bin-dir target

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

@ -1,30 +1,56 @@
#!/bin/bash
###############################################################################
# This script builds a multi-architecture manifest image using the
# manifest tool in the bin directory.
# This script expects that the individual images have been built, tagged, and
# pushed to the registry.
# This script builds a multi-architecture manifest image. It expects that the
# the individual images already exist in the destination registry.
###############################################################################
set -e
set -euo pipefail
###############################################################################
# Define Environment Variables
###############################################################################
SCRIPT_NAME=$(basename $0)
# Get directory of running script
DIR=$(cd "$(dirname "$0")" && pwd)
BUILD_REPOSITORY_LOCALPATH=${BUILD_REPOSITORY_LOCALPATH:-$DIR/../..}
ROOT_FOLDER=$BUILD_REPOSITORY_LOCALPATH
# Holds the list of tags to apply
DOCKER_TAGS="[]"
DEFAULT_DOCKER_NAMESPACE="microsoft"
DEFAULT_ARCH='amd64,arm64,arm/v7'
ARCH=$DEFAULT_ARCH
DOCKER_TAGS='[]'
DEFAULT_DOCKER_NAMESPACE='microsoft'
DOCKER_NAMESPACE=$DEFAULT_DOCKER_NAMESPACE
DOCKER_IMAGE_NAME=""
IGNORE_MISSING=""
DOCKER_IMAGE_NAME=
IGNORE_MISSING=
###############################################################################
# Check format and content of --target-arch argument
###############################################################################
check_arch() {
IFS=',' read -a architectures <<< "$ARCH"
for arch in ${architectures[@]}
do
case "$arch" in
'amd64'|'arm64'|'arm/v7') ;;
*) echo "Unsupported architecture '$arch'" && exit 1 ;;
esac
done
}
###############################################################################
# Convert from the format of the --target-arch argument to the format we use in
# our image tags. Docker defines the former (amd64, arm64, or arm/v7; see
# Docker's TARGETARCH automatic variable[1]), we define the latter (amd64,
# arm64v8, and arm32v7).
# [1] https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
###############################################################################
convert_arch() {
arch="$1"
case "$arch" in
'amd64') echo 'amd64' ;;
'arm64') echo 'arm64v8' ;;
'arm/v7') echo 'arm32v7' ;;
*) echo "Unsupported architecture '$arch'" && exit 1 ;;
esac
}
###############################################################################
# Print usage information pertaining to this script and exit
@ -35,13 +61,12 @@ usage()
echo "Note: Depending on the options you might have to run this as root or sudo."
echo ""
echo "options"
echo " -r, --registry Docker registry required to build, tag and run the module"
echo " -n, --namespace Docker namespace (default: $DEFAULT_DOCKER_NAMESPACE)"
echo " -i, --image-name Docker image name (Optional if specified in template yaml)"
echo " -v, --image-version Docker Image Version."
echo " -t, --template Yaml file template for manifest definition."
echo " --tags Additional tags to add to the docker image. Specify as a list of strings. e.g. --tags \"['1.0']\""
echo " --ignore-missing Ignore missing images in manifest"
echo " -r, --registry Docker registry required to build, tag and run the module"
echo " -n, --namespace Docker namespace (default: $DEFAULT_DOCKER_NAMESPACE)"
echo " -i, --image-name Docker image name"
echo " -v, --image-version Docker image version. Assumes arch-specific images have the same tag with '-linux-{arch] appended'"
echo " -t, --target-arch Comma-separated list of architectures to combine into multi-arch image (default: $DEFAULT_ARCH)"
echo " --tags Add tags to the docker image. Specify as a JSON array of strings, e.g., --tags '[\"1.0\"]'"
exit 1;
}
@ -63,52 +88,53 @@ process_args()
DOCKER_REGISTRY="$arg"
save_next_arg=0
elif [ $save_next_arg -eq 2 ]; then
DOCKER_IMAGEVERSION="$arg"
save_next_arg=0
elif [ $save_next_arg -eq 3 ]; then
YAML_TEMPLATE="$arg"
save_next_arg=0
elif [ $save_next_arg -eq 4 ]; then
DOCKER_TAGS="$arg"
save_next_arg=0
elif [ $save_next_arg -eq 5 ]; then
DOCKER_NAMESPACE="$arg"
save_next_arg=0
elif [ $save_next_arg -eq 6 ]; then
elif [ $save_next_arg -eq 3 ]; then
DOCKER_IMAGE_NAME="$arg"
save_next_arg=0
elif [ $save_next_arg -eq 4 ]; then
DOCKER_IMAGEVERSION="$arg"
save_next_arg=0
elif [ $save_next_arg -eq 5 ]; then
ARCH="$arg"
check_arch
save_next_arg=0
elif [ $save_next_arg -eq 6 ]; then
DOCKER_TAGS="$arg"
save_next_arg=0
else
case "$arg" in
"-h" | "--help" ) usage;;
"-r" | "--registry" ) save_next_arg=1;;
"-v" | "--image-version" ) save_next_arg=2;;
"-t" | "--template" ) save_next_arg=3;;
"--tags" ) save_next_arg=4;;
"-n" | "--namespace" ) save_next_arg=5;;
"-i" | "--image-name" ) save_next_arg=6;;
"--ignore-missing" ) IGNORE_MISSING="--ignore-missing";;
"-n" | "--namespace" ) save_next_arg=2;;
"-i" | "--image-name" ) save_next_arg=3;;
"-v" | "--image-version" ) save_next_arg=4;;
"-t" | "--target-arch" ) save_next_arg=5;;
"--tags" ) save_next_arg=6;;
* ) usage;;
esac
fi
done
if [[ -z ${DOCKER_REGISTRY} ]]; then
echo "Registry Parameter Invalid"
if [[ -z "$DOCKER_REGISTRY" ]]; then
echo 'The --registry parameter is required'
print_help_and_exit
fi
if [[ -z ${DOCKER_IMAGEVERSION} ]]; then
echo "Docker image version not found."
if [[ -z "$DOCKER_IMAGE_NAME" ]]; then
echo 'The --image-name parameter is required'
print_help_and_exit
fi
if [[ -z ${YAML_TEMPLATE} ]]; then
echo "Template file not found."
if [[ -z "$DOCKER_IMAGEVERSION" ]]; then
echo 'The --image-version parameter is required'
print_help_and_exit
fi
if [[ -z ${DOCKER_IMAGE_NAME} ]]; then
echo "Docker image name not set, assuming name in template"
if [[ $(echo "$DOCKER_TAGS" | jq -r '. | type') != 'array' ]]; then
echo 'The value of --tags must be a JSON array'
print_help_and_exit
fi
}
@ -117,26 +143,24 @@ process_args()
###############################################################################
process_args $@
# Create temp file to store modified yaml file
manifest=$(mktemp /tmp/manifest.yaml.XXXXXX)
[ $? -eq 0 ] || exit $?
image_name="$DOCKER_REGISTRY/$DOCKER_NAMESPACE/$DOCKER_IMAGE_NAME"
arch_digests=()
sed "s/__REGISTRY__/${DOCKER_REGISTRY}/g; s/__VERSION__/${DOCKER_IMAGEVERSION}/g; s/__TAGS__/${DOCKER_TAGS}/g; s/__NAMESPACE__/${DOCKER_NAMESPACE}/g; s/__NAME__/${DOCKER_IMAGE_NAME}/g;" $YAML_TEMPLATE > $manifest
[ $? -eq 0 ] || exit $?
IFS=',' read -a architectures <<< "$ARCH"
for arch in ${architectures[@]}
do
image="$image_name:$DOCKER_IMAGEVERSION-linux-$(convert_arch $arch)"
arch_digests+=( $(docker buildx imagetools inspect $image --format '{{json .Manifest}}' |
jq --arg arch "$arch" -r '.manifests[] |
select($arch == ([.platform | (.architecture, .variant // empty)] | join("/"))) |
.digest') )
done
echo "Build image with following manifest:"
cat $manifest
# combine the primary tag (e.g., '1.4.0') and any caller-supplied tags into an array
tags=( $(echo "$DOCKER_TAGS" |
jq -r --arg primary_tag "$DOCKER_IMAGEVERSION" '. + [ $primary_tag ] | unique | join("\n")') )
# Download and execute the manifest tool
curl -Lo /tmp/manifest-tool 'https://edgebuild.blob.core.windows.net/iotedge-win-arm32v7-tools/manifest-tool-linux-amd64' &&
chmod +x /tmp/manifest-tool &&
/tmp/manifest-tool --debug push from-spec $IGNORE_MISSING $manifest
echo "Done Building And Pushing Docker Images"
[ $? -eq 0 ] || exit $?
# Remove the temp file
rm $manifest
[ $? -eq 0 ] || exit $?
# build the multi-arch image with all given tags, using all given arch-specific images as sources
docker buildx imagetools create \
${tags[@]/#/--tag $image_name:} \
"${arch_digests[@]/#/$image_name@}"

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

@ -16,7 +16,6 @@ SCRIPT_NAME=$(basename "$0")
ARCH=
BUILD_NUMBER=
OUTPUT_DIR=
POSTFIX=
SOURCE_MAP=
###############################################################################
@ -26,8 +25,7 @@ function usage() {
echo "$SCRIPT_NAME [options]"
echo ""
echo "options"
echo "--output-dir Path where to put librocksdb folder containing built artifact."
echo "--postfix Options: amd64, armhf, arm64."
echo "--output-dir Path to librocksdb folder that contains resulting binaries."
echo "--build-number Build number for which to tag image."
echo "--arch Options: amd64, arm32v7, arm64v8."
echo "--source-map Path to the JSON file that maps Dockerfile image sources to their replacements. Assumes the tool 'gnarly' is in the PATH"
@ -50,30 +48,33 @@ function process_args() {
OUTPUT_DIR=$arg
save_next_arg=0
elif [ ${save_next_arg} -eq 2 ]; then
POSTFIX=$arg
save_next_arg=0
elif [ ${save_next_arg} -eq 3 ]; then
BUILD_NUMBER=$arg
save_next_arg=0
elif [ ${save_next_arg} -eq 4 ]; then
elif [ ${save_next_arg} -eq 3 ]; then
ARCH=$arg
save_next_arg=0
elif [[ ${save_next_arg} -eq 5 ]]; then
elif [[ ${save_next_arg} -eq 4 ]]; then
SOURCE_MAP="$arg"
save_next_arg=0
else
case "$arg" in
"-h" | "--help") usage ;;
"--output-dir") save_next_arg=1 ;;
"--postfix") save_next_arg=2 ;;
"--build-number") save_next_arg=3 ;;
"--arch") save_next_arg=4 ;;
"--source-map") save_next_arg=5 ;;
"--build-number") save_next_arg=2 ;;
"--arch") save_next_arg=3 ;;
"--source-map") save_next_arg=4 ;;
*) usage ;;
esac
fi
done
if [ ! -d "$OUTPUT_DIR" ]; then
echo "Value '$OUTPUT_DIR' specified by --output-dir is not a valid directory"
print_help_and_exit
fi
OUTPUT_DIR=$(realpath $OUTPUT_DIR)
if [[ -n "$SOURCE_MAP" ]] && [[ ! -f "$SOURCE_MAP" ]]; then
echo "File specified by --source-map does not exist"
print_help_and_exit
@ -88,15 +89,14 @@ function process_args() {
process_args "$@"
case "$ARCH" in
'amd64') platform='linux/amd64' ;;
'arm32v7') platform='linux/arm/v7' ;;
'arm64v8') platform='linux/arm64' ;;
*) echo "Unrecognized platform '$ARCH'" && exit 1
'amd64') platform='linux/amd64' ;;
'arm32v7') platform='linux/arm/v7' ;;
'arm64v8') platform='linux/arm64' ;;
*) echo "Unrecognized platform '$ARCH'" && exit 1
esac
build_image=rocksdb-build:main-$POSTFIX-$BUILD_NUMBER
mkdir -p $OUTPUT_DIR/librocksdb
cd $BUILD_REPOSITORY_LOCALPATH/edge-util/docker/linux/$ARCH
build_image=rocksdb-build:main-$ARCH-$BUILD_NUMBER
cd $BUILD_REPOSITORY_LOCALPATH/edge-util/docker/linux
build_context=
if [[ -n "$SOURCE_MAP" ]]; then
@ -113,4 +113,9 @@ docker buildx build \
$([ -z "$build_context" ] || echo $build_context) \
.
docker run --rm -v $OUTPUT_DIR/librocksdb:/artifacts $build_image cp /publish/librocksdb.so.$POSTFIX /artifacts
docker run \
--rm \
--platform $platform \
-v $OUTPUT_DIR/librocksdb/$platform:/artifacts/$platform \
$build_image \
cp /publish/$platform/librocksdb.so /artifacts/$platform/

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

@ -1,18 +0,0 @@
image: __REGISTRY__/__NAMESPACE__/__NAME__:__VERSION__
tags: __TAGS__
manifests:
-
image: __REGISTRY__/__NAMESPACE__/__NAME__:__VERSION__-linux-amd64
platform:
architecture: amd64
os: linux
-
image: __REGISTRY__/__NAMESPACE__/__NAME__:__VERSION__-linux-arm32v7
platform:
architecture: arm
os: linux
-
image: __REGISTRY__/__NAMESPACE__/__NAME__:__VERSION__-linux-arm64v8
platform:
architecture: aarch64
os: linux

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

@ -10,9 +10,7 @@
</PropertyGroup>
<ItemGroup>
<None Remove="docker\linux\amd64\Dockerfile" />
<None Remove="docker\linux\arm32v7\Dockerfile" />
<None Remove="docker\linux\arm64v8\Dockerfile" />
<None Remove="docker\linux\Dockerfile" />
</ItemGroup>
<ItemGroup>

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

@ -1,21 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
RUN apk update && \
apk add --no-cache iproute2
ENV MODULE_NAME "NetworkController.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet NetworkController.dll

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

@ -1,21 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
RUN apk update && \
apk add --no-cache iproute2
ENV MODULE_NAME "NetworkController.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet NetworkController.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "CloudToDeviceMessageTester.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet CloudToDeviceMessageTester.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "CloudToDeviceMessageTester.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet CloudToDeviceMessageTester.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "DeploymentTester.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet DeploymentTester.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "DeploymentTester.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet DeploymentTester.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "DirectMethodReceiver.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"[%Y-%m-%d %H:%M:%S %:z]"): Starting Module" && \
exec /usr/bin/dotnet DirectMethodReceiver.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "DirectMethodReceiver.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet DirectMethodReceiver.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "DirectMethodSender.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet DirectMethodSender.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "DirectMethodSender.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet DirectMethodSender.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "EdgeHubRestartTester.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet EdgeHubRestartTester.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "EdgeHubRestartTester.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet EdgeHubRestartTester.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "MetricsValidator.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet MetricsValidator.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "MetricsValidator.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet MetricsValidator.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "ModuleRestarter.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet ModuleRestarter.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "ModuleRestarter.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet ModuleRestarter.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "NumberLogger.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
ENTRYPOINT /usr/bin/dotnet NumberLogger.dll

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

@ -1,17 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "NumberLogger.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
ENTRYPOINT /usr/bin/dotnet NumberLogger.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "Relayer.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet Relayer.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "Relayer.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet Relayer.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "TemperatureFilter.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Temperature Filter" && \
exec /usr/bin/dotnet TemperatureFilter.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "TemperatureFilter.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Temperature Filter" && \
exec /usr/bin/dotnet TemperatureFilter.dll

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

@ -3,6 +3,7 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
ARG TARGETPLATFORM
# RocksDB requires snappy
RUN apk update && \
@ -19,7 +20,7 @@ RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.arm64 /usr/local/lib/librocksdb.so
COPY $EXE_DIR/librocksdb/$TARGETPLATFORM/librocksdb.so /usr/local/lib/librocksdb.so
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TestAnalyzer.dll

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

@ -1,25 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy libcap
ENV MODULE_NAME "TestAnalyzer.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.amd64 /usr/local/lib/librocksdb.so
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TestAnalyzer.dll

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

@ -1,25 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy libcap
ENV MODULE_NAME "TestAnalyzer.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.armhf /usr/local/lib/librocksdb.so
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TestAnalyzer.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "TestMetricsCollector.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TestMetricsCollector.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "TestMetricsCollector.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TestMetricsCollector.dll

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

@ -3,6 +3,7 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
ARG TARGETPLATFORM
# RocksDB requires snappy
RUN apk update && \
@ -22,7 +23,7 @@ RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.armhf /usr/local/lib/librocksdb.so
COPY $EXE_DIR/librocksdb/$TARGETPLATFORM/librocksdb.so /usr/local/lib/librocksdb.so
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TestResultCoordinator.dll

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

@ -1,28 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy libcap
ENV MODULE_NAME "TestResultCoordinator.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Expose HTTP port
EXPOSE 5001/tcp
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.amd64 /usr/local/lib/librocksdb.so
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TestResultCoordinator.dll

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

@ -1,28 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy libcap
ENV MODULE_NAME "TestResultCoordinator.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Expose HTTP port
EXPOSE 5001/tcp
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.arm64 /usr/local/lib/librocksdb.so
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TestResultCoordinator.dll

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

@ -3,6 +3,7 @@
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ARG TARGETPLATFORM
# RocksDB requires snappy
RUN apk update && \
@ -15,7 +16,7 @@ WORKDIR /app
COPY $EXE_DIR/ ./
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.amd64 /usr/local/lib/librocksdb.so
COPY $EXE_DIR/librocksdb/$TARGETPLATFORM/librocksdb.so /usr/local/lib/librocksdb.so
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser

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

@ -1,25 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy libcap
ENV MODULE_NAME "TwinTester.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.armhf /usr/local/lib/librocksdb.so
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TwinTester.dll

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

@ -1,25 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine
ARG EXE_DIR=.
# RocksDB requires snappy
RUN apk update && \
apk add --no-cache snappy libcap
ENV MODULE_NAME "TwinTester.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Install RocksDB
COPY $EXE_DIR/librocksdb/librocksdb.so.arm64 /usr/local/lib/librocksdb.so
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet TwinTester.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "load-gen.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet load-gen.dll

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

@ -1,18 +0,0 @@
# syntax=docker/dockerfile:1.4
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine
ARG EXE_DIR=.
ENV MODULE_NAME "load-gen.dll"
WORKDIR /app
COPY $EXE_DIR/ ./
# Add an unprivileged user account for running the module
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser
CMD echo "$(date --utc +"%Y-%m-%d %H:%M:%S %:z") Starting Module" && \
exec /usr/bin/dotnet load-gen.dll