ci: bake deps into images
This commit is contained in:
parent
9fc1b41f73
commit
0f46b57575
@ -1,13 +1,10 @@
|
|||||||
FROM python:3.12-slim
|
FROM registry.bstein.dev/bstein/ariadne-base:py312
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY requirements.txt /app/requirements.txt
|
|
||||||
RUN pip install --no-cache-dir -r /app/requirements.txt
|
|
||||||
|
|
||||||
COPY ariadne /app/ariadne
|
COPY ariadne /app/ariadne
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|||||||
9
Dockerfile.base
Normal file
9
Dockerfile.base
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt /app/requirements.txt
|
||||||
|
RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||||
6
Dockerfile.ci
Normal file
6
Dockerfile.ci
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM registry.bstein.dev/bstein/ariadne-base:py312
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements-dev.txt /app/requirements-dev.txt
|
||||||
|
RUN pip install --no-cache-dir -r /app/requirements-dev.txt
|
||||||
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@ -13,6 +13,8 @@ spec:
|
|||||||
nodeSelector:
|
nodeSelector:
|
||||||
kubernetes.io/arch: arm64
|
kubernetes.io/arch: arm64
|
||||||
node-role.kubernetes.io/worker: "true"
|
node-role.kubernetes.io/worker: "true"
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: harbor-bstein-robot
|
||||||
containers:
|
containers:
|
||||||
- name: dind
|
- name: dind
|
||||||
image: docker:27-dind
|
image: docker:27-dind
|
||||||
@ -47,7 +49,7 @@ spec:
|
|||||||
- name: harbor-config
|
- name: harbor-config
|
||||||
mountPath: /docker-config
|
mountPath: /docker-config
|
||||||
- name: tester
|
- name: tester
|
||||||
image: python:3.12-slim
|
image: registry.bstein.dev/bstein/ariadne-ci:py312
|
||||||
command: ["cat"]
|
command: ["cat"]
|
||||||
tty: true
|
tty: true
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@ -99,7 +101,6 @@ spec:
|
|||||||
container('tester') {
|
container('tester') {
|
||||||
sh(script: '''
|
sh(script: '''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
python -m pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
python -m ruff check ariadne --select C90,PLR
|
python -m ruff check ariadne --select C90,PLR
|
||||||
python -m slipcover \
|
python -m slipcover \
|
||||||
@ -137,14 +138,9 @@ PY
|
|||||||
container('builder') {
|
container('builder') {
|
||||||
sh '''
|
sh '''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
apk add --no-cache bash git jq
|
|
||||||
mkdir -p /root/.docker
|
mkdir -p /root/.docker
|
||||||
cp /docker-config/config.json /root/.docker/config.json
|
cp /docker-config/config.json /root/.docker/config.json
|
||||||
echo "Docker config: ${DOCKER_CONFIG:-unset} HOME=${HOME:-unset}"
|
echo "Docker config: ${DOCKER_CONFIG:-unset} HOME=${HOME:-unset}"
|
||||||
REGISTRY_HOST="registry.bstein.dev"
|
|
||||||
USERNAME=$(jq -r ".auths[\\"${REGISTRY_HOST}\\"].username" /root/.docker/config.json)
|
|
||||||
PASSWORD=$(jq -r ".auths[\\"${REGISTRY_HOST}\\"].password" /root/.docker/config.json)
|
|
||||||
echo "${PASSWORD}" | docker login "${REGISTRY_HOST}" -u "${USERNAME}" --password-stdin
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,14 +152,7 @@ PY
|
|||||||
script {
|
script {
|
||||||
sh '''
|
sh '''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
if git describe --tags --exact-match >/dev/null 2>&1; then
|
SEMVER="0.1.0-${BUILD_NUMBER}"
|
||||||
SEMVER="$(git describe --tags --exact-match)"
|
|
||||||
else
|
|
||||||
SEMVER="0.1.0-${BUILD_NUMBER}"
|
|
||||||
fi
|
|
||||||
if ! echo "$SEMVER" | grep -Eq '^v?[0-9]+[.][0-9]+[.][0-9]+([-.][0-9A-Za-z]+)?$'; then
|
|
||||||
SEMVER="0.1.0-${BUILD_NUMBER}"
|
|
||||||
fi
|
|
||||||
echo "SEMVER=${SEMVER}" > build.env
|
echo "SEMVER=${SEMVER}" > build.env
|
||||||
'''
|
'''
|
||||||
def props = readProperties file: 'build.env'
|
def props = readProperties file: 'build.env'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user