This commit is contained in:
Nikola Kubiczek 2023-09-08 21:41:33 +02:00
parent 6bf92b2241
commit 88f3bb9800
Signed by: yaemiku
GPG Key ID: ADC039636B3E4AAB
2 changed files with 22 additions and 16 deletions

View File

@ -6,18 +6,25 @@ stages:
before_script:
- if [ -n "$KUBE_CONTEXT" ]; then kubectl config use-context "$KUBE_CONTEXT"; fi
build:
default:
image: docker:24.0.5
services:
- docker:24.0.5-dind
before_script:
- docker info
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_TLS_VERIFY: 1
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
docker_build:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.14.0-debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"registry.yaemiku.dev\":{\"auth\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "registry.yaemiku.dev/yaemiku/hamburger:${CI_COMMIT_TAG}"
- docker build -t registry.yaemiku.dev/yaemiku/hamburger -t registry.yaemiku.dev/yaemiku/hamburger:$CI_COMMIT_TAG .
- docker login -u yaemiku -p $DOCKER_PASSWORD registry.yaemiku.dev
- docker push -a registry.yaemiku.dev/yaemiku/hamburger
rules:
- if: $CI_COMMIT_TAG
@ -26,12 +33,11 @@ deploy:
extends: [.kube-context]
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
image:
name: bitnami/kubectl:latest
entrypoint: [""]
script:
- ls
- kubectl apply -f $CI_PROJECT_DIR/hamburger.yaml
- kubectl get pods
rules:
- if: $CI_COMMIT_TAG
- kubectl get pods -n

View File

@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: hamburger
image: registry.yaemiku.dev/yaemiku/hamburger
image: registry.yaemiku.dev/yaemiku/hamburger:latest
ports:
- containerPort: 3000
imagePullSecrets: