Replace container image dynamically using kustomization.yaml

This commit is contained in:
Daniel_I_Am 2021-09-03 23:40:13 +02:00
parent 3f270e0f88
commit fe38f88e73
3 changed files with 6 additions and 1 deletions

View File

@ -51,6 +51,7 @@ deploy-job:
- cp "$ENV_PRODUCTION" "./build/.env.production" - cp "$ENV_PRODUCTION" "./build/.env.production"
- cp "$MYSQL_ENV" "./build/mysql-secret.env" - cp "$MYSQL_ENV" "./build/mysql-secret.env"
- cd "./build" - cd "./build"
- sed -i "s/DOCKER_IMAGE_TAG/${CI_COMMIT_SHORT_SHA}/g" kustomization.yaml
- kubectl apply -k ./ - kubectl apply -k ./
- echo "Waiting for deployment..." - echo "Waiting for deployment..."
- sleep 30 - sleep 30

View File

@ -73,7 +73,7 @@ spec:
tier: website tier: website
spec: spec:
containers: containers:
- image: registry.chaoticlogic.us/daniel-website:latest - image: website-image
imagePullPolicy: Always imagePullPolicy: Always
name: website name: website
ports: ports:

View File

@ -15,3 +15,7 @@ secretGenerator:
namespace: portfolio namespace: portfolio
envs: envs:
- mysql-secret.env - mysql-secret.env
images:
- name: website-image
newName: registry.chaoticlogic.us/daniel-website
newTag: DOCKER_IMAGE_TAG