-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
81 lines (67 loc) · 2.63 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
80
81
variables:
PLATFORMS: "linux/arm64/v8,linux/amd64"
DOCKER_BUILDKIT: "1"
download_db:
image: ubuntu:latest
script:
- apt-get update
- apt-get install -y wget
- mkdir -p ./data
- wget "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=$MAXMIND_LICENSE_KEY&suffix=tar.gz" -O "data/GeoLite2-Country.mmdb.tar.gz"
- wget "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=$MAXMIND_LICENSE_KEY&suffix=tar.gz" -O "data/GeoLite2-City.mmdb.tar.gz"
artifacts:
paths:
- data/*
build:
needs:
- job: download_db
artifacts: true
image: docker:latest
services:
- docker:dind
script:
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_JOB_TOKEN}" "${CI_REGISTRY}"
- docker pull "${BASE_IMAGE}:${PYTHON_VERSION}" || true
# Install QEMU emulation support in the kernel
# See: https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images
- docker run --privileged --rm tonistiigi/binfmt --install all
# Create a buildx instance if one doesn't already exist
- if [ "$(docker buildx ls | grep docker-container | wc -l)" -le "0" ]; then
docker context create buildx-build;
docker buildx create --use buildx-build;
fi
- docker buildx build
--platform "$PLATFORMS"
--pull
--build-arg BASE_IMAGE=$BASE_IMAGE
--build-arg PYTHON_VERSION=$PYTHON_VERSION
--cache-from "${CI_REGISTRY_IMAGE}:${OUTPUT_TAG_NAME}"
--tag "${CI_REGISTRY_IMAGE}:${OUTPUT_TAG_NAME}"
--file Dockerfile .
--push
- docker buildx build
--platform "$PLATFORMS"
--pull
--build-arg BASE_IMAGE=$BASE_IMAGE
--build-arg PYTHON_VERSION=$PYTHON_VERSION
--build-arg GEOSPATIAL=true
--cache-from "${CI_REGISTRY_IMAGE}:${OUTPUT_TAG_NAME}"
--tag "${CI_REGISTRY_IMAGE}:${OUTPUT_TAG_NAME}-geospatial"
--file Dockerfile .
--push
parallel:
matrix:
# Python
- BASE_IMAGE: registry.gitlab.com/thelabnyc/python:py311
OUTPUT_TAG_NAME: "3.11"
- BASE_IMAGE: registry.gitlab.com/thelabnyc/python:py312
OUTPUT_TAG_NAME: "3.12"
- BASE_IMAGE: registry.gitlab.com/thelabnyc/python:py313
OUTPUT_TAG_NAME: "3.13"
# Python + Node 20
- BASE_IMAGE: registry.gitlab.com/thelabnyc/python:py311-node20
OUTPUT_TAG_NAME: "3.11-node20"
- BASE_IMAGE: registry.gitlab.com/thelabnyc/python:py312-node20
OUTPUT_TAG_NAME: "3.12-node20"
- BASE_IMAGE: registry.gitlab.com/thelabnyc/python:py313-node20
OUTPUT_TAG_NAME: "3.13-node20"