-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
79 lines (74 loc) · 1.8 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
.python_job_template:
image: python:3.10
interruptible: true
download_deps:
extends: .python_job_template
stage: download_deps
before_script:
- mkdir ~/.pip
- python -m venv venv
- source ./venv/bin/activate
script:
- pip install --no-cache-dir --upgrade pip
- pip install -r requirements-dev.txt
artifacts:
paths:
- "venv"
expire_in: 2 hour
rules:
- if: $CI_COMMIT_BRANCH
tags:
- docker
.lint_test_template:
extends: .python_job_template
dependencies:
- download_deps
before_script:
- source ./venv/bin/activate
rules:
- if: $CI_COMMIT_BRANCH
lint:
extends: .lint_test_template
stage: lint
script:
- deptry .
- black . --check
- ruff check .
tags:
- docker
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.10.0-debug
entrypoint: [ "" ]
before_script:
# Login to registry
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$REGISTRY_HOSTNAME\":{\"username\":\"$REGISTRY_USERNAME\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script:
- >
/kaniko/executor \
--context ${CI_PROJECT_DIR} \
--dockerfile ${CI_PROJECT_DIR}/docker/python/Dockerfile \
--destination ${REGISTRY_HOSTNAME}/${REPOSITORY_PATH}/python:${CI_COMMIT_REF_NAME} \
--snapshotMode=redo \
--use-new-run=true \
--cache \
--cleanup
- >
/kaniko/executor \
--context ${CI_PROJECT_DIR} \
--dockerfile ${CI_PROJECT_DIR}/docker/nginx/Dockerfile \
--destination ${REGISTRY_HOSTNAME}/${REPOSITORY_PATH}/nginx:${CI_COMMIT_REF_NAME} \
--snapshotMode=redo \
--use-new-run=true \
--cache \
--cleanup
only:
- tags
tags:
- docker
stages:
- download_deps
- lint
- build