Skip to content

Commit

Permalink
chore(docker): migrate to ghcr.io
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-efremoff committed May 30, 2024
1 parent 3fe5e16 commit 6aebaa1
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manual-docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if ( test "true" = "${{ inputs.override }}" || ! docker pull ${TARGET_IMAGE} ) ; then
npm run docker:build:dev --dockertag=${UI_TAG}
echo '${{ secrets.DOCKER_HUB_PASSWORD }}' | docker login --username ${{ secrets.DOCKER_HUB_LOGIN}} --password-stdin
echo '${{ secrets.GITHUB_TOKEN }}' | docker login --username ${{ github.actor }} --password-stdin ghcr.io
npm run docker:push --dockertag=${UI_TAG}
else
echo Corresponding image already exists: $TARGET_IMAGE
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/manual-docker-copy-to-ghcr.io.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "[manual]: Copy docker image to ghcr.io"

on:
workflow_dispatch:
inputs:
stag:
description: "ytsaurus/ui:[SOURCE_TAG]"
required: true
ttag:
description: "ghcr.io/ytsaurus/ui:[TARGET_TAG]"
required: true
nightly:
description: "Use '-nightly' suffix for SOURCE image name"
type: boolean
nigtly_target:
description: "Use '-nightly' suffix for TARGET image name"
default: true
type: boolean

jobs:
docker-tag:
runs-on: ubuntu-latest
steps:
- name: "Docker tag"
run: |
if [ "true" = "${{ inputs.nightly }}" ]; then
SOURCE_IMAGE=ytsaurus/ui-nightly:${{ inputs.stag }}
else
SOURCE_IMAGE=ytsaurus/ui:${{ inputs.stag }}
fi
if [ "true" = "${{ inputs.nightly_target }}" ];
TARGET_IMAMGE=ghcr.io/ytsaurus/ui-nightly:${{ inputs.ttag }}
else
TARGET_IMAMGE=ghcr.io/ytsaurus/ui:${{ inputs.ttag }}
fi
docker pull ${SOURCE_IMAGE}
docker tag ${SOURCE_IMAGE} ${TARGET_IMAMGE}
echo '${{ secrets.GITHUB_TOKEN }}' | docker login --username ${{ github.actor }} --password-stdin ghcr.io
docker push ${TARGET_IMAMGE}
8 changes: 4 additions & 4 deletions .github/workflows/manual-docker-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
steps:
- name: "Docker tag"
run: |
echo '${{ secrets.DOCKER_HUB_PASSWORD }}' | docker login --username ${{ secrets.DOCKER_HUB_LOGIN}} --password-stdin
SOURCE_IMAGE=ytsaurus/ui-nightly:${{ inputs.stag }}
TARGET_IMAMGE=ytsaurus/ui:${{ inputs.ttag }}
SOURCE_IMAGE=ghcr.io/ytsaurus/ui-nightly:${{ inputs.stag }}
TARGET_IMAMGE=ghcr.io/ytsaurus/ui:${{ inputs.ttag }}
docker pull ${SOURCE_IMAGE}
docker tag ${SOURCE_IMAGE} ${TARGET_IMAMGE}
echo '${{ secrets.GITHUB_TOKEN }}' | docker login --username ${{ github.actor }} --password-stdin ghcr.io
docker push ${TARGET_IMAMGE}
4 changes: 2 additions & 2 deletions .github/workflows/release-please-hotfix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ jobs:
if ! docker pull ${TARGET_IMAGE} ; then
npm run docker:build --dockertag=${UI_TAG}
echo '${{ secrets.DOCKER_HUB_PASSWORD }}' | docker login --username ${{ secrets.DOCKER_HUB_LOGIN}} --password-stdin
echo '${{ secrets.GITHUB_TOKEN }}' | docker login --username ${{ github.actor }} --password-stdin ghcr.io
npm run docker:push --dockertag=${UI_TAG}
STABLE_IMAGE=ytsaurus/ui:stable
STABLE_IMAGE=$(echo $UI_IMAGE | sed 's/-nightly$//g'):stable
docker tag ${TARGET_IMAGE} ${STABLE_IMAGE}
docker push ${STABLE_IMAGE}
else
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,20 @@ jobs:
run: |
cd packages/ui
UI_IMAGE=$(npm run show:docker-image-name | tail -n 1)
UI_TAG=$(npm run show:version | tail -n 1)
UI_IMAGE=$(npm run -s show:docker-image-name)
UI_TAG=$(npm run -s show:version)
TARGET_IMAGE=${UI_IMAGE}:${UI_TAG}
echo target image and tag: ${TARGET_IMAGE}
if ! docker pull ${TARGET_IMAGE} ; then
npm run docker:build --dockertag=${UI_TAG}
echo '${{ secrets.DOCKER_HUB_PASSWORD }}' | docker login --username ${{ secrets.DOCKER_HUB_LOGIN}} --password-stdin
echo '${{ secrets.GITHUB_TOKEN }}' | docker login --username ${{ github.actor }} --password-stdin ghcr.io
npm run docker:push --dockertag=${UI_TAG}
docker tag ${TARGET_IMAGE} ytsaurus/ui:latest
docker push ytsaurus/ui:latest
LATEST_IMAGE=$(echo $UI_IMAGE | sed 's/-nightly//g'):latest
docker tag ${TARGET_IMAGE} ${LATEST_IMAGE}
docker push ${LATEST_IMAGE}
else
echo Corresponding image already exists
fi
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"update:icons": "./scripts/update-icons.sh"
},
"config": {
"docker_image": "ytsaurus/ui-nightly"
"docker_image": "ghcr.io/ytsaurus/ui-nightly"
},
"dependencies": {
"@doc-tools/transform": "^2.18.3",
Expand Down

0 comments on commit 6aebaa1

Please sign in to comment.