REFACTOR(ci): simplify to kaniko direct push
Some checks failed
Build and Push to Zot / build-and-push (push) Has been cancelled
Some checks failed
Build and Push to Zot / build-and-push (push) Has been cancelled
- Remove crane container and use kaniko direct push - Mount dockerconfigjson secret for registry auth - Fix zot manifest compatibility issue
This commit is contained in:
@@ -29,48 +29,25 @@ jobs:
|
|||||||
backoffLimit: 0
|
backoffLimit: 0
|
||||||
template:
|
template:
|
||||||
spec:
|
spec:
|
||||||
initContainers:
|
containers:
|
||||||
- name: kaniko
|
- name: kaniko
|
||||||
image: gcr.io/kaniko-project/executor:latest
|
image: gcr.io/kaniko-project/executor:latest
|
||||||
args:
|
args:
|
||||||
- "--context=git://github0213.com/Mayne0213/jovies.git#refs/heads/main"
|
- "--context=git://github0213.com/Mayne0213/jovies.git#refs/heads/main"
|
||||||
- "--context-sub-path=nextjs"
|
- "--context-sub-path=nextjs"
|
||||||
- "--dockerfile=Dockerfile"
|
- "--dockerfile=Dockerfile"
|
||||||
- "--no-push"
|
- "--destination=${REGISTRY}/${IMAGE_NAME}:latest"
|
||||||
- "--tar-path=/workspace/image.tar"
|
- "--destination=${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA}"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: workspace
|
- name: docker-config
|
||||||
mountPath: /workspace
|
mountPath: /kaniko/.docker
|
||||||
containers:
|
|
||||||
- name: crane
|
|
||||||
image: gcr.io/go-containerregistry/crane:debug
|
|
||||||
command: ["/busybox/sh", "-exc"]
|
|
||||||
args:
|
|
||||||
- |
|
|
||||||
echo "Pushing image to ${REGISTRY}/${IMAGE_NAME}..."
|
|
||||||
ls -la /workspace/
|
|
||||||
crane auth login ${REGISTRY} -u \$(cat /secrets/username) -p \$(cat /secrets/password)
|
|
||||||
crane push /workspace/image.tar ${REGISTRY}/${IMAGE_NAME}:latest
|
|
||||||
crane push /workspace/image.tar ${REGISTRY}/${IMAGE_NAME}:${GITHUB_SHA}
|
|
||||||
echo "Done!"
|
|
||||||
env:
|
|
||||||
- name: REGISTRY
|
|
||||||
value: "${REGISTRY}"
|
|
||||||
- name: IMAGE_NAME
|
|
||||||
value: "${IMAGE_NAME}"
|
|
||||||
- name: GITHUB_SHA
|
|
||||||
value: "${GITHUB_SHA}"
|
|
||||||
volumeMounts:
|
|
||||||
- name: workspace
|
|
||||||
mountPath: /workspace
|
|
||||||
- name: zot-creds
|
|
||||||
mountPath: /secrets
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: workspace
|
- name: docker-config
|
||||||
emptyDir: {}
|
|
||||||
- name: zot-creds
|
|
||||||
secret:
|
secret:
|
||||||
secretName: zot-registry-credentials-plain
|
secretName: zot-registry-credentials
|
||||||
|
items:
|
||||||
|
- key: .dockerconfigjson
|
||||||
|
path: config.json
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user