Skip to content

Switch digitial ocean to github docker registry #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ jobs:
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Login DigitalOcean container registry
run: doctl registry login
- name: Login to Github Container Registry
run: docker login ghcr.io -u saulshanabrook -p "${{ secrets.CR_PAT }}"

- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save python-record-api
Expand Down
13 changes: 4 additions & 9 deletions k8/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PYTHON_PACKAGE_VERSION := $(shell python -c 'import record_api; print(record_api

$(info Python package version = ${PYTHON_PACKAGE_VERSION})

IMAGE := registry.digitalocean.com/python-record-api
IMAGE := ghcr.io/data-apis

# The tag for base image is base-{python version}-{version-increment}
# The tag for other versions are {name}-{python version}-{base version increment}-{version increment}
Expand All @@ -15,13 +15,10 @@ version = $(shell cat images/$(1)/version)

BASE_IMAGE := ${IMAGE}/base:${PYTHON_PACKAGE_VERSION}-$(call version,base)

BASE_CACHE_IMAGE := ${IMAGE}/base:cache

$(info Base image = ${BASE_IMAGE})

sub_tag = $(1):${PYTHON_PACKAGE_VERSION}-$(call version,base)-$(call version,$(1))
sub_image = ${IMAGE}/$(call sub_tag,$(1))
sub_cache_image = ${IMAGE}/$(1):cache

WORKFLOW_VERSION := $(shell cat argo/version)
$(info Workflow version = ${WORKFLOW_VERSION})
Expand Down Expand Up @@ -144,12 +141,13 @@ define JQ_DOCKER_BAKE
{
"base-base": {
dockerfile: "Dockerfile",
labels: {
"org.opencontainers.image.source": "https://github.com/data-apis/python-record-api"
}
},
base: {
context: "images/base",
inherits: ["base-base"],
"cache-to": ["type=registry,ref=${BASE_CACHE_IMAGE},mode=max"],
"cache-from": ["type=registry,ref=${BASE_CACHE_IMAGE}"],
args: {
PYTHON_PACKAGE_VERSION: "${PYTHON_PACKAGE_VERSION}"
},
Expand All @@ -168,8 +166,6 @@ define JQ_DOCKER_BAKE
args: {
FROM: "${BASE_IMAGE}"
},
"cache-to": ["type=registry,ref=" + ($$ARGS.named[(. + "-cache")]) + ",mode=max"],
"cache-from": ["type=registry,ref=" + ($$ARGS.named[(. + "-cache")])],
tags: [
($$ARGS.named[(.)])
]
Expand All @@ -188,7 +184,6 @@ docker-bake.json: Makefile images/
jq "$$JQ_DOCKER_BAKE" \
--null-input \
$(foreach name,$(IMAGES),--arg $(name) $(call sub_image,$(name))) \
$(foreach name,$(IMAGES),--arg $(name)-cache $(call sub_cache_image,$(name))) \
--args $(IMAGES) \
> $@

Expand Down