Nicolas Dorier
6 years ago
committed by
GitHub
4 changed files with 111 additions and 6 deletions
@ -0,0 +1,71 @@ |
|||
version: 2 |
|||
jobs: |
|||
# Define in CircleCi Project Variables: $DOCKERHUB_REPO, $DOCKERHUB_USER, $DOCKERHUB_PASS |
|||
# Publish jobs require those variables |
|||
publish_docker_linuxamd64: |
|||
machine: |
|||
docker_layer_caching: true |
|||
steps: |
|||
- checkout |
|||
- run: |
|||
command: | |
|||
cd docker-compose-generator |
|||
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS |
|||
sudo docker build --pull -t $DOCKERHUB_REPO:latest-amd64 -f Dockerfile.linuxamd64 . |
|||
sudo docker push $DOCKERHUB_REPO:latest-amd64 |
|||
|
|||
publish_docker_linuxarm: |
|||
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-arm32v7 -f Dockerfile.linuxarm32v7 . |
|||
sudo docker push $DOCKERHUB_REPO:latest-arm32v7 |
|||
|
|||
publish_docker_multiarch: |
|||
machine: |
|||
enabled: true |
|||
image: circleci/classic:201808-01 |
|||
steps: |
|||
- run: |
|||
command: | |
|||
# Turn on Experimental features |
|||
sudo mkdir $HOME/.docker |
|||
sudo sh -c 'echo "{ \"experimental\": \"enabled\" }" >> $HOME/.docker/config.json' |
|||
# |
|||
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 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 push $DOCKERHUB_REPO:latest -p |
|||
|
|||
workflows: |
|||
version: 2 |
|||
build_and_test: |
|||
jobs: |
|||
- test |
|||
|
|||
publish: |
|||
jobs: |
|||
- publish_docker_linuxamd64: |
|||
filters: |
|||
branches: |
|||
only: dcg-latest |
|||
- publish_docker_linuxarm: |
|||
filters: |
|||
branches: |
|||
only: dcg-latest |
|||
- publish_docker_multiarch: |
|||
requires: |
|||
- publish_docker_linuxamd64 |
|||
- publish_docker_linuxarm |
|||
filters: |
|||
branches: |
|||
only: dcg-latest |
@ -0,0 +1,22 @@ |
|||
# This is a manifest image, will pull the image with the same arch as the builder machine |
|||
FROM microsoft/dotnet:2.1.500-sdk AS builder |
|||
WORKDIR /source |
|||
COPY src/docker-compose-generator.csproj docker-compose-generator.csproj |
|||
# Cache some dependencies |
|||
RUN dotnet restore |
|||
COPY src/. . |
|||
RUN dotnet publish --output /app/ --configuration Release |
|||
|
|||
# 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 microsoft/dotnet:2.1.6-aspnetcore-runtime-stretch-slim-arm32v7 |
|||
WORKDIR /datadir |
|||
|
|||
WORKDIR /app |
|||
ENV APP_DATADIR=/datadir |
|||
VOLUME /datadir |
|||
|
|||
ENV INSIDE_CONTAINER=1 |
|||
|
|||
COPY --from=builder "/app" . |
|||
|
|||
ENTRYPOINT ["dotnet", "docker-compose-generator.dll"] |
Loading…
Reference in new issue