Skip to content
Snippets Groups Projects
Commit 4e38458d authored by Nicolas M. Thiéry's avatar Nicolas M. Thiéry
Browse files

CI: Update image build to latest best practices (kaniko, ...)

parent d8f170e0
No related branches found
No related tags found
No related merge requests found
Pipeline #54006 passed
stages:
- build_image
#- test
variables: variables:
DEPENDENCIES_IMAGE_NAME: "${CI_REGISTRY_IMAGE}/image:latest" IMAGE: "${CI_REGISTRY_IMAGE}/image:latest"
MYDOCKER_IMAGE_NAME: "${CI_REGISTRY_IMAGE}/mydocker-image:latest" IMAGE_WITH_VERSION: "${CI_REGISTRY_IMAGE}/image:${CI_COMMIT_SHA}"
STORAGE_DRIVER: vfs # for buildah
REGISTRY_AUTH_FILE: /root/auth.json
build_image: build_image:
stage: build_image # ref: https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
# image: tomkukral/buildah:0.31 tags:
before_script: - docker
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY image:
# - podman login --username "${CI_REGISTRY_USER}" --password "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}" name: gcr.io/kaniko-project/executor:v1.23.2-debug
entrypoint: [""]
script: script:
- docker build -t ${DEPENDENCIES_IMAGE_NAME} --file Dockerfile-CI . - /kaniko/executor
- docker push ${DEPENDENCIES_IMAGE_NAME} --context "${CI_PROJECT_DIR}"
# - buildah build-using-dockerfile --format docker -t ${DEPENDENCIES_IMAGE_NAME} --file Dockerfile-CI . --dockerfile "${CI_PROJECT_DIR}/Dockerfile-CI"
# - buildah push --authfile ${REGISTRY_AUTH_FILE} ${DEPENDENCIES_IMAGE_NAME} --destination "${IMAGE_WITH_VERSION}"
after_script: --destination "${IMAGE}"
- podman logout "${CI_REGISTRY}" --cache=true
# only: --single-snapshot
# changes: --snapshot-mode=time
# --compressed-caching=false
image: ${DEPENDENCIES_IMAGE_NAME}
# test: # test:
# stage: test # stage: test
......
...@@ -5,16 +5,30 @@ COPY --chown=$MAMBA_USER:$MAMBA_USER . /tmp/binder ...@@ -5,16 +5,30 @@ COPY --chown=$MAMBA_USER:$MAMBA_USER . /tmp/binder
# Install conda packages # Install conda packages
RUN cd /tmp/binder && \ RUN cd /tmp/binder && \
micromamba install -y -n base -f environment.yml && \ micromamba install -y -n base -f environment.yml && \
micromamba clean --all --yes micromamba clean --all --yes && \
/usr/local/bin/_entrypoint.sh pip cache purge
# Install configuration files
# After installing the packages to make sure these
# take precedence
RUN cp -rav /tmp/binder/install_files/* /opt/conda/
# Install configuration files after installing the packages to make
# sure these take precedence
RUN cp -rav /tmp/binder/install_files/* /opt/conda/
RUN rm -rf /tmp/binder RUN rm -rf /tmp/binder
# Set up environment # Set up environment
VOLUME /home/mambauser WORKDIR /home/mambauser
ENV SHELL=/bin/bash ENV SHELL=/bin/bash
ENV LANG fr_FR.UTF-8 ENV LANG fr_FR.UTF-8
USER root
# Activate the conda environment in the shell
RUN /usr/local/bin/_entrypoint.sh mamba shell activate >> /etc/profile.d/conda.sh
# Install debian packages
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends \
less tree \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER $MAMBA_USER
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