Skip to content
Snippets Groups Projects
Commit c6223c6a authored by Hannes Feldt's avatar Hannes Feldt
Browse files

Add prebuild step for docker base image

parent b4bb5a91
No related branches found
No related tags found
1 merge request!12Add prebuild step for docker base image
default:
image: python:3.10 # use latest for building/linting
image: $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG
before_script:
- python --version # For debugging
- python -m pip install --upgrade pip
- pip install --upgrade tox twine
cache:
paths:
- .cache/pip
# Do not cache .tox, to recreate virtualenvs for every step
stages:
- prepare
- lint
# check if this needs to be a separate step
# - build_extensions
......@@ -18,6 +17,13 @@ stages:
- integration
- publish # publish instead of deploy
# Prepare image to run ci on
trigger_prepare:
stage: prepare
trigger:
strategy: depend
include: .prepare.gitlab-ci.yml
# Caching of dependencies to speed up builds
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
......
stages:
- build
build_ci_runner_image:
stage: build
image: docker:stable
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- |
if docker pull $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG; then
docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG ci-runner
else
docker pull $CI_REGISTRY_IMAGE/ci-build-runner:latest || true
docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:latest --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG ci-runner
fi
- docker push $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG # push the image
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
docker image tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG $CI_REGISTRY_IMAGE/ci-build-runner:latest
docker push $CI_REGISTRY_IMAGE/ci-build-runner:latest
fi
FROM python:3.10
RUN python -m pip install --upgrade pip
RUN pip install --upgrade tox twine
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment