Skip to content

Commit 934530a

Browse files
Try switching to digital ocean container registry
1 parent d26f9ca commit 934530a

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

.github/workflows/workflow.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ jobs:
8888
with:
8989
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
9090

91-
# https://github.com/actions/starter-workflows/blob/master/ci/docker-publish.yml#L54
92-
- name: Log into docker registry
93-
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
94-
91+
- name: Login DigitalOcean container registry
92+
run: doctl registry login
93+
9594
- name: Save DigitalOcean kubeconfig
9695
run: doctl kubernetes cluster kubeconfig save python-record-api
9796

k8/Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PYTHON_PACKAGE_VERSION := $(shell python -c 'import record_api; print(record_api
33

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

6-
IMAGE := saulshanabrook/python-record-api
6+
IMAGE := registry.digitalocean.com/python-record-api
77

88
# The tag for base image is base-{python version}-{version-increment}
99
# The tag for other versions are {name}-{python version}-{base version increment}-{version increment}
@@ -12,17 +12,17 @@ IMAGE := saulshanabrook/python-record-api
1212
version = $(shell cat images/$(1)/version)
1313

1414

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

1717
$(info Base image = ${BASE_IMAGE})
1818

19-
sub_tag = $(1)-${PYTHON_PACKAGE_VERSION}-$(call version,base)-$(call version,$(1))
20-
sub_image = ${IMAGE}:$(call sub_tag,$(1))
19+
sub_tag = $(1):${PYTHON_PACKAGE_VERSION}-$(call version,base)-$(call version,$(1))
20+
sub_image = ${IMAGE}/$(call sub_tag,$(1))
2121

2222
WORKFLOW_VERSION := $(shell cat argo/version)
2323
$(info Workflow version = ${WORKFLOW_VERSION})
2424

25-
workflow_name = $(call sub_tag,$(1))-${WORKFLOW_VERSION}
25+
workflow_name = $(subst :,-,$(call sub_tag,$(1)))-${WORKFLOW_VERSION}
2626

2727
IMAGES := $(sort $(filter-out base,$(notdir $(wildcard images/*))))
2828

@@ -107,6 +107,8 @@ test-%: docker-bake.json
107107
# Generate docker bake file with default group
108108
# https://github.com/docker/buildx/issues/183#issuecomment-551216260
109109

110+
# file parsing
111+
# https://github.com/docker/buildx/blob/fd6de6b6aeac780c59e5079a96b068076b676d73/bake/bake.go#L333
110112
define JQ_DOCKER_BAKE
111113
{
112114
group: {
@@ -116,9 +118,13 @@ define JQ_DOCKER_BAKE
116118
},
117119
target: (
118120
{
121+
"base-base": {
122+
dockerfile: "Dockerfile",
123+
"cache-to": ["type=local,dest=./cache"]
124+
},
119125
base: {
120126
context: "images/base",
121-
dockerfile: "Dockerfile",
127+
inherits: ["base-base"],
122128
args: {
123129
PYTHON_PACKAGE_VERSION: "${PYTHON_PACKAGE_VERSION}"
124130
},
@@ -133,7 +139,7 @@ define JQ_DOCKER_BAKE
133139
($$ARGS.positional[]) | {
134140
(.): {
135141
context: ("images/" + .),
136-
dockerfile: "Dockerfile",
142+
inherits: ["base-base"],
137143
args: {
138144
FROM: "${BASE_IMAGE}"
139145
},

0 commit comments

Comments
 (0)