Skip to content
Snippets Groups Projects
Verified Commit cb26c8d8 authored by Robotka István Adrián's avatar Robotka István Adrián
Browse files

multiple docker image build

parent 4838229b
Branches
No related tags found
No related merge requests found
Pipeline #4783 passed with warnings
/.idea/ /.idea/
/venv/ /venv/
data data
__pycache__
image: registry.kszk.bme.hu/baseimg/python-tools image: python:3.8.5-buster
stages: stages:
- Get dependencies - Get dependencies
...@@ -6,32 +6,60 @@ stages: ...@@ -6,32 +6,60 @@ stages:
- Docker build - Docker build
variables: variables:
# git tag or branch name
CONTAINER_IMAGE: "registry.kszk.bme.hu/monitoring/pupak:$CI_COMMIT_REF_NAME" CONTAINER_IMAGE: "registry.kszk.bme.hu/monitoring/pupak:$CI_COMMIT_REF_NAME"
pip: pip:
stage: Get dependencies stage: Get dependencies
script: script:
- python --version
- pip install -r requirements.txt - pip install -r requirements.txt
flake8: flake8:
stage: Static Analysis stage: Static Analysis
script: script:
- pip install flake8
- flake8 --max-line-length=120 *.py - flake8 --max-line-length=120 *.py
pylint: pylint:
stage: Static Analysis stage: Static Analysis
allow_failure: true allow_failure: true
script: script:
- pip install pylint
- pylint -d C0301 *.py - pylint -d C0301 *.py
docker build: docker kszk:
extends: .image-template
variables:
REGISTRY: registry.kszk.bme.hu
REGISTRY_USER: "$KSZK_NEXUS_USERNAME"
REGISTRY_PASSWORD: "$KSZK_NEXUS_PASSWORD"
IMAGE: registry.kszk.bme.hu/monitoring/pupak:$CI_COMMIT_REF_NAME
docker hub:
extends: .image-template
variables:
REGISTRY: "https://index.docker.io/v1/"
REGISTRY_USER: "$HUB_USER"
REGISTRY_PASSWORD: "$HUB_PASS"
IMAGE: robotka/pupak:$CI_COMMIT_REF_NAME
###################### Docker image build template #######################
# hidden job, not gonna run, just for the inheritance
.image-template:
stage: Docker build stage: Docker build
image: image:
name: gcr.io/kaniko-project/executor:debug name: gcr.io/kaniko-project/executor:debug
entrypoint: [""] entrypoint: [""]
script: script:
- echo "{\"auths\":{\"registry.kszk.bme.hu\":{\"username\":\"$KSZK_NEXUS_USERNAME\",\"password\":\"$KSZK_NEXUS_PASSWORD\"}}}" > /kaniko/.docker/config.json - echo "{\"auths\":{\"$REGISTRY\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}"
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination "$CONTAINER_IMAGE" > /kaniko/.docker/config.json
- echo "Push $IMAGE to $REGISTRY"
- /kaniko/executor
--context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/Dockerfile
--destination "$IMAGE"
only: only:
- master - master
- tags
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment