Skip to content

Commit

Permalink
Push docker images into auroraprodacr.azurecr.io and auroradevacr.azu…
Browse files Browse the repository at this point in the history
…recr.io (#179)

* Fixing bug with ignoring environment config errors

* Revert Default for GordoEnvironmentConfig

* Default environment variables for integration tests

* test

* Revert "test"

This reverts commit 2ac66f1.

* Using auroraprodacr.azurecr.io and auroradevacr.azurecr.io

* Do not use github.event_name in doker.yaml workflow
  • Loading branch information
koropets authored Nov 2, 2020
1 parent 3d85ef1 commit 392c9a2
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ on:
- master
tags:
- "*"
pull_request:

jobs:
push-image:
name: Push docker to ${{ matrix.registry }}
name: Push docker images
runs-on: ubuntu-latest

strategy:
matrix:
registry: [auroraprodacr.azurecr.io]

steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -28,27 +25,48 @@ jobs:
- name: Prepare variables
id: prep
env:
DOCKER_REGISTRY: ${{ matrix.registry }}
DOCKER_PROD_REGISTRY: auroraprodacr.azurecr.io
DOCKER_DEV_REGISTRY: auroradevacr.azurecr.io
run: |
DOCKER_IMAGE=${DOCKER_REGISTRY}/equinor/gordo-controller
DOCKER_DEV_IMAGE=${DOCKER_DEV_REGISTRY}/equinor/gordo-controller
DOCKER_PROD_IMAGE=${DOCKER_PROD_REGISTRY}/equinor/gordo-controller
IMAGE_TYPE="prod"
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/pull/* ]]; then
IMAGE_TYPE="dev"
VERSION=pr-${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${GITHUB_SHA::8}"
if [[ -n "$VERSION" ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:${VERSION}"
TAGS="${DOCKER_DEV_IMAGE}:latest,${DOCKER_DEV_IMAGE}:${GITHUB_SHA::8}"
if [[ $IMAGE_TYPE == "prod" ]]; then
TAGS="$TAGS,${DOCKER_PROD_IMAGE}:latest,${DOCKER_PROD_IMAGE}:${GITHUB_SHA::8}"
if [[ -n "$VERSION" ]]; then
TAGS="$TAGS,${DOCKER_PROD_IMAGE}:${VERSION}"
fi
else
if [[ -n "$VERSION" ]]; then
TAGS="$TAGS,${DOCKER_DEV_IMAGE}:${VERSION}"
fi
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Login to DockerHub
- name: Login to auroraprodacr
uses: docker/login-action@v1
with:
registry: ${{ matrix.registry }}
registry: auroraprodacr.azurecr.io
username: ${{ secrets.DOCKER_PROD_USERNAME }}
password: ${{ secrets.DOCKER_PROD_TOKEN }}

- name: Login to auroradevacr
uses: docker/login-action@v1
with:
registry: auroradevacr.azurecr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
Expand Down

0 comments on commit 392c9a2

Please sign in to comment.