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: before_script:
- if [ -n "$KUBE_CONTEXT" ]; then kubectl config use-context "$KUBE_CONTEXT"; fi - 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 stage: build
image:
name: gcr.io/kaniko-project/executor:v1.14.0-debug
entrypoint: [""]
script: script:
- mkdir -p /kaniko/.docker - docker build -t registry.yaemiku.dev/yaemiku/hamburger -t registry.yaemiku.dev/yaemiku/hamburger:$CI_COMMIT_TAG .
- echo "{\"auths\":{\"registry.yaemiku.dev\":{\"auth\":\"$DOCKER_PASSWORD\"}}}" > /kaniko/.docker/config.json - docker login -u yaemiku -p $DOCKER_PASSWORD registry.yaemiku.dev
- /kaniko/executor - docker push -a registry.yaemiku.dev/yaemiku/hamburger
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "registry.yaemiku.dev/yaemiku/hamburger:${CI_COMMIT_TAG}"
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
@ -26,12 +33,11 @@ deploy:
extends: [.kube-context] extends: [.kube-context]
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
image: image:
name: bitnami/kubectl:latest name: bitnami/kubectl:latest
entrypoint: [""] entrypoint: [""]
script: script:
- ls - ls
- kubectl apply -f $CI_PROJECT_DIR/hamburger.yaml - kubectl apply -f $CI_PROJECT_DIR/hamburger.yaml
- kubectl get pods - kubectl get pods -n
rules:
- if: $CI_COMMIT_TAG

View File

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