diff --git a/.docker/build-image b/.docker/build-image index 793302d..33e0c14 100755 --- a/.docker/build-image +++ b/.docker/build-image @@ -3,8 +3,9 @@ # CI_GIT_REF= CI_COMMIT_SHA=$(git rev-parse --short HEAD) .docker/build-image APP_DIR="./" -DOCKER_REPO="zdenekdrahos/phpqa" +DOCKER_REPO="edgedesigncz/phpqa" DOCKER_FILE=".docker/Dockerfile" +DOCKER_REGISTRY=${DOCKER_REGISTRY:-"ghcr.io"} DOCKER_TAG="" GIT_VERSION="" GIT_TAG="" @@ -37,7 +38,7 @@ load_docker_variables () { echo "PHP version $PHP_VERSION not supported" exit 1 fi - DOCKER_TAG="$DOCKER_REPO:$GIT_VERSION-php$PHP_VERSION" + DOCKER_TAG="$DOCKER_REGISTRY/$DOCKER_REPO:$GIT_VERSION-php$PHP_VERSION" echo "Dockefile: $DOCKER_FILE" echo "Build vars: COMPOSER_VERSION=$COMPOSER_VERSION UPDATE_COMPOSER=$UPDATE_COMPOSER" @@ -55,11 +56,7 @@ build_docker_image () { --build-arg "UPDATE_COMPOSER=$UPDATE_COMPOSER" docker run --rm -t $DOCKER_TAG sh -c "php --version && composer --version && composer outdated --direct --all && phpqa tools" - if [ -z "$GIT_TAG" ]; then - echo "Docker image is published only if the current build is for a git tag" - exit 0 - fi - docker login --username $DOCKER_USER --password $DOCKER_TOKEN + docker login --username $DOCKER_USER --password $DOCKER_TOKEN $DOCKER_REGISTRY time docker push $DOCKER_TAG } diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6c02e91..9b0fb6d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,8 +21,9 @@ jobs: env: CI_GIT_REF: ${{ github.ref }} CI_COMMIT_SHA: ${{ github.sha }} - DOCKER_USER: ${{ secrets.DOCKER_USER }} - DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} + DOCKER_USER: ${{ github.actor }} + DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCKER_REGISTRY: ghcr.io run: | PHP_VERSION=7.2 .docker/build-image PHP_VERSION=8.1 .docker/build-image