fix: delete image after build or push, use orgsecret

This commit is contained in:
Markus Pesch 2021-01-08 16:53:49 +01:00
parent a600c9e8f1
commit 4a053cc485
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
4 changed files with 14 additions and 16 deletions

View File

@ -3,7 +3,6 @@ type: docker
name: build-image-x86_64 name: build-image-x86_64
steps: steps:
- name: build-image-latest - name: build-image-latest
image: docker.io/volkerraschek/build-image:latest image: docker.io/volkerraschek/build-image:latest
commands: commands:
@ -21,33 +20,24 @@ steps:
- make container-image/push - make container-image/push
environment: environment:
CONTAINER_IMAGE_REGISTRY_PASSWORD: CONTAINER_IMAGE_REGISTRY_PASSWORD:
from_secret: CONTAINER_IMAGE_REGISTRY_PASSWORD from_secret: container_image_registry_password
volumes: volumes:
- name: docker_socket - name: docker_socket
path: /var/run/docker.sock path: /var/run/docker.sock
when: when:
branch: branch:
- master - master
event:
- push
- cron
- name: push-image-tagged - name: delete-image-latest
image: docker.io/volkerraschek/build-image:latest image: docker.io/volkerraschek/build-image:latest
commands: commands:
- make container-image/push - make container-image/delete
environment:
CONTAINER_IMAGE_VERSION: ${DRONE_TAG}
CONTAINER_IMAGE_REGISTRY_PASSWORD:
from_secret: CONTAINER_IMAGE_REGISTRY_PASSWORD
volumes: volumes:
- name: docker_socket - name: docker_socket
path: /var/run/docker.sock path: /var/run/docker.sock
when: when:
branch: branch:
- master - master
event:
- tag
- name: notify - name: notify
image: drillster/drone-email image: drillster/drone-email

1
.gitignore vendored
View File

@ -0,0 +1 @@
.env

View File

@ -19,7 +19,7 @@ CONTAINER_IMAGE_REGISTRY_NAME:=docker.io
CONTAINER_IMAGE_REGISTRY_USER:=volkerraschek CONTAINER_IMAGE_REGISTRY_USER:=volkerraschek
CONTAINER_IMAGE_NAMESPACE?=${CONTAINER_IMAGE_REGISTRY_USER} CONTAINER_IMAGE_NAMESPACE?=${CONTAINER_IMAGE_REGISTRY_USER}
CONTAINER_IMAGE_NAME:=build-image CONTAINER_IMAGE_NAME:=network-tools
CONTAINER_IMAGE_VERSION?=latest CONTAINER_IMAGE_VERSION?=latest
CONTAINER_IMAGE_FULL=${CONTAINER_IMAGE_REGISTRY_NAME}/${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION} CONTAINER_IMAGE_FULL=${CONTAINER_IMAGE_REGISTRY_NAME}/${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION}
CONTAINER_IMAGE_SHORT=${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION} CONTAINER_IMAGE_SHORT=${CONTAINER_IMAGE_NAMESPACE}/${CONTAINER_IMAGE_NAME}:${CONTAINER_IMAGE_VERSION}
@ -37,6 +37,13 @@ container-image/build:
--tag ${CONTAINER_IMAGE_SHORT} \ --tag ${CONTAINER_IMAGE_SHORT} \
. .
# DELETE CONTAINER IMAGE
# ==============================================================================
PHONY:=container-image/delete
container-image/delete:
- ${CONTAINER_RUNTIME} image rm ${CONTAINER_IMAGE_FULL} ${CONTAINER_IMAGE_SHORT}
- ${CONTAINER_RUNTIME} image rm ${BASE_IMAGE_FULL}
# PUSH CONTAINER IMAGE # PUSH CONTAINER IMAGE
# ============================================================================== # ==============================================================================
PHONY+=container-image/push PHONY+=container-image/push

View File

@ -28,11 +28,11 @@ For a kubernetes environment you can use the [YAML-File](network-tools.yaml) by
executing the following command. executing the following command.
```bash ```bash
$ kubectl create -f https://git.cryptic.systems/volker.raschek/network-tools/network-tools.yml kubectl create -f https://git.cryptic.systems/volker.raschek/network-tools/network-tools.yml
``` ```
Execute a shell inside the container by Execute a shell inside the container by
```bash ```bash
kubectl exec -it network-tools -- sh kubectl exec -it network-tools -- sh
``` ```