Skip to content
Snippets Groups Projects
Verified Commit b2e62b4e authored by Quentin Duchemin's avatar Quentin Duchemin
Browse files

Create a pica-ci base image built only once, should decrease overall build time

parent 39346f11
No related branches found
No related tags found
No related merge requests found
......@@ -9,14 +9,35 @@ services:
- docker:19.03.0-dind
stages:
- pica-ci-base
- metabuild
- build
- static_tests
- dynamic_tests
- deployment
# build the container that further steps will run in in order to avoid duplicating instructions between steps
metabuild:
# build the base image used for all further steps : this is done only when pica-ci's Dockerfile is modified
pica-ci-base:
stage: pica-ci-base
before_script:
- echo $REGISTRY_PROD_PASSWORD | docker login $REGISTRY_PROD -u $REGISTRY_PROD_USERNAME --password-stdin
script:
- docker build -f pica-ci-base/Dockerfile . -t $REGISTRY_PROD/pica-ci-base:latest
- docker push $REGISTRY_PROD/pica-ci-base:latest
after_script:
- docker logout $REGISTRY_PROD
tags: [build]
only:
changes:
- "pica-ci-base/*"
refs:
- master
- dev-ci
- tx-services-p19-test
- dev-sympa
# create a image based on pica-ci with only a few environment variables added (which Dockerfile has been modified...)
metabuid:
stage: metabuild
before_script:
- echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USERNAME --password-stdin
......
FROM docker:19.03.0
RUN apk update && \
apk add build-base \
git \
gnupg \
iproute2 \
libffi-dev \
openssl-dev \
py-pip \
python2-dev \
sed \
wget && \
pip install docker-compose
FROM docker:19.03.0
FROM registry.picasoft.net/pica-ci-base:latest
&
WORKDIR /workdir
COPY . /workdir/
RUN apk update && \
apk add build-base \
git \
gnupg \
iproute2 \
libffi-dev \
openssl-dev \
py-pip \
python2-dev \
sed \
wget && \
pip install docker-compose && \
chmod +x get-modified-image.sh get-host-by-image.sh decrypt-secrets.sh && \
RUN chmod +x get-modified-image.sh get-host-by-image.sh decrypt-secrets.sh && \
export MODIFIED_IMAGE_FULL=$(./get-modified-image.sh) && \
export MODIFIED_IMAGE=$(echo $MODIFIED_IMAGE_FULL | cut -d ':' -f1) && \
export CONTAINER_NAME=$(cat $MODIFIED_IMAGE/docker-compose.yml | grep $MODIFIED_IMAGE -B1 | head -n1 | cut -d ':' -f1 | xargs) && \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment