Browse Source

Add armv64 to the dockerfile generator

Kukks-patch-1
nicolas.dorier 6 years ago
parent
commit
8a8128c60a
No known key found for this signature in database GPG Key ID: 6618763EF09186FE
  1. 34
      .circleci/config.yml
  2. 22
      docker-compose-generator/linuxarm64v8.Dockerfile
  3. 3
      docker-compose-generator/src/docker-compose-generator.csproj

34
.circleci/config.yml

@ -2,7 +2,7 @@ version: 2
jobs: jobs:
# Define in CircleCi Project Variables: $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS # Define in CircleCi Project Variables: $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS
# Publish jobs require those variables # Publish jobs require those variables
publish_docker_linuxamd64: amd64:
machine: machine:
docker_layer_caching: true docker_layer_caching: true
steps: steps:
@ -14,7 +14,7 @@ jobs:
sudo docker build --pull -t $DOCKERHUB_REPO:latest-amd64 -f linuxamd64.Dockerfile . sudo docker build --pull -t $DOCKERHUB_REPO:latest-amd64 -f linuxamd64.Dockerfile .
sudo docker push $DOCKERHUB_REPO:latest-amd64 sudo docker push $DOCKERHUB_REPO:latest-amd64
publish_docker_linuxarm32v7: arm32v7:
machine: machine:
docker_layer_caching: true docker_layer_caching: true
steps: steps:
@ -27,8 +27,20 @@ jobs:
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker build --pull -t $DOCKERHUB_REPO:latest-arm32v7 -f linuxarm32v7.Dockerfile . sudo docker build --pull -t $DOCKERHUB_REPO:latest-arm32v7 -f linuxarm32v7.Dockerfile .
sudo docker push $DOCKERHUB_REPO:latest-arm32v7 sudo docker push $DOCKERHUB_REPO:latest-arm32v7
arm64v8:
publish_docker_multiarch: machine:
docker_layer_caching: true
steps:
- checkout
- run:
command: |
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
#
cd docker-compose-generator
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker build --pull -t $DOCKERHUB_REPO:latest-arm64v8 -f linuxarm64v8.Dockerfile .
sudo docker push $DOCKERHUB_REPO:latest-arm64v8
multiarch:
machine: machine:
enabled: true enabled: true
image: circleci/classic:201808-01 image: circleci/classic:201808-01
@ -41,27 +53,29 @@ jobs:
# #
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
# #
sudo docker manifest create --amend $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-amd64 $DOCKERHUB_REPO:latest-arm32v7 sudo docker manifest create --amend $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-amd64 $DOCKERHUB_REPO:latest-arm32v7 $DOCKERHUB_REPO:latest-arm64v8
sudo docker manifest annotate $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-amd64 --os linux --arch amd64 sudo docker manifest annotate $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-amd64 --os linux --arch amd64
sudo docker manifest annotate $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-arm32v7 --os linux --arch arm --variant v7 sudo docker manifest annotate $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-arm32v7 --os linux --arch arm --variant v7
sudo docker manifest annotate $DOCKERHUB_REPO:latest $DOCKERHUB_REPO:latest-arm64v8 --os linux --arch arm64 --variant v8
sudo docker manifest push $DOCKERHUB_REPO:latest -p sudo docker manifest push $DOCKERHUB_REPO:latest -p
workflows: workflows:
version: 2 version: 2
publish: publish:
jobs: jobs:
- publish_docker_linuxamd64: - amd64:
filters: filters:
branches: branches:
only: dcg-latest only: dcg-latest
- publish_docker_linuxarm32v7: - arm32v7:
filters: filters:
branches: branches:
only: dcg-latest only: dcg-latest
- publish_docker_multiarch: - multiarch:
requires: requires:
- publish_docker_linuxamd64 - amd64
- publish_docker_linuxarm32v7 - arm32v7
- arm64v8
filters: filters:
branches: branches:
only: dcg-latest only: dcg-latest

22
docker-compose-generator/linuxarm64v8.Dockerfile

@ -0,0 +1,22 @@
# This is a manifest image, will pull the image with the same arch as the builder machine
FROM mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview7 AS builder
WORKDIR /source
COPY src/docker-compose-generator.csproj docker-compose-generator.csproj
# Cache some dependencies
RUN dotnet restore /p:TargetFrameworkOverride=netcoreapp3.0
COPY src/. .
RUN dotnet publish --output /app/ --configuration Release /p:TargetFrameworkOverride=netcoreapp3.0
# Force the builder machine to take make an arm runtime image. This is fine as long as the builder does not run any program
FROM mcr.microsoft.com/dotnet/core/runtime:3.0.0-preview7-buster-slim-arm64v8
WORKDIR /datadir
WORKDIR /app
ENV APP_DATADIR=/datadir
VOLUME /datadir
ENV INSIDE_CONTAINER=1
COPY --from=builder "/app" .
ENTRYPOINT ["dotnet", "docker-compose-generator.dll"]

3
docker-compose-generator/src/docker-compose-generator.csproj

@ -2,7 +2,8 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">netcoreapp2.1</TargetFramework>
<TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">$(TargetFrameworkOverride)</TargetFramework>
<RootNamespace>DockerGenerator</RootNamespace> <RootNamespace>DockerGenerator</RootNamespace>
</PropertyGroup> </PropertyGroup>

Loading…
Cancel
Save