Skip to content

Commit

Permalink
Add docker github action
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Nov 20, 2020
1 parent 09c3d7b commit 2fbbaa6
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 37 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This travis file relis on the following environment variable to configure on your travis repository settings:
# * DOCKER_USERNAME: A docker hub user where images will be pushed
# * DOCKER_API_KEY: The password of the dockerhub user
# * DOCKERHUB_REPO: The docker repository to push to

name: Docker

# Controls when the action will run.
on:
push:
tags:
- 'releases/*'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
DOCKERHUB_USER: nicolasdorier
DOCKERHUB_REPO: ndlc-cli

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
amd64:
name: Build/Push amd64
runs-on: ubuntu-latest
env:
DOCKERFILE: amd64.Dockerfile
ARCH: amd64
steps:
- uses: actions/checkout@v2
- run: ./Build/makedocker.sh
env:
DOCKER_API_KEY: ${{ secrets.DOCKER_API_KEY }}
arm32:
name: Build/Push arm32v7
runs-on: ubuntu-latest
env:
DOCKERFILE: arm32v7.Dockerfile
ARCH: arm32v7
steps:
- uses: actions/checkout@v2
- run: ./Build/makedocker.sh
env:
DOCKER_API_KEY: ${{ secrets.DOCKER_API_KEY }}
arm64v8:
name: Build/Push arm64v8
runs-on: ubuntu-latest
env:
DOCKERFILE: arm64v8.Dockerfile
ARCH: arm64v8
steps:
- uses: actions/checkout@v2
- run: ./Build/makedocker.sh
env:
DOCKER_API_KEY: ${{ secrets.DOCKER_API_KEY }}
manifest:
name: "Create docker manifest"
runs-on: ubuntu-latest
needs: [amd64, arm32, arm64v8]
if: ${{ success() }}
steps:
- uses: actions/checkout@v2
- run: ./Build/makedockermanifest.sh
5 changes: 0 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# This travis file relis on the following environment variable to configure on your travis repository settings:
# * DOCKERHUB_USER: A docker hub user where images will be pushed
# * DOCKERHUB_PASS: The password of the dockerhub user
# * DOCKERHUB_REPO: The docker repository to push to

name: CI

# Controls when the action will run.
Expand Down
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Build/makedocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ DOCKER_TAG="$DOCKERHUB_USER/$DOCKERHUB_REPO:$VERSION-$ARCH"
echo "Docker tag: $DOCKER_TAG"
sudo docker build --pull -t "$DOCKER_TAG" -f "$DOCKERFILE" .

sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker login "--username=$DOCKERHUB_USER" "--password=$DOCKER_API_KEY"
sudo docker push "$DOCKER_TAG"
6 changes: 3 additions & 3 deletions Build/makedockermanifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ DOCKER_TAG="$DOCKERHUB_USER/$DOCKERHUB_REPO:$VERSION"

echo "Docker tag: $DOCKER_TAG"

sudo mkdir $HOME/.docker
sudo sh -c 'echo "{ \"experimental\": \"enabled\" }" >> $HOME/.docker/config.json'
sudo mkdir -p $HOME/.docker
sudo sh -c 'echo "{ \"experimental\": \"enabled\" }" > $HOME/.docker/config.json'
#
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker login "--username=$DOCKERHUB_USER" "--password=$DOCKER_API_KEY"
#

sudo docker manifest create --amend $DOCKER_TAG $DOCKER_TAG-amd64 $DOCKER_TAG-arm32v7 $DOCKER_TAG-arm64v8
Expand Down
1 change: 1 addition & 0 deletions NDLC.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CI", "CI", "{B373E8BF-D73D-
ProjectSection(SolutionItems) = preProject
Build\buildtest.Dockerfile = Build\buildtest.Dockerfile
Build\buildtest.sh = Build\buildtest.sh
.github\workflows\docker.yml = .github\workflows\docker.yml
.github\workflows\main.yml = .github\workflows\main.yml
Build\makedocker.sh = Build\makedocker.sh
Build\makedockermanifest.sh = Build\makedockermanifest.sh
Expand Down

0 comments on commit 2fbbaa6

Please sign in to comment.