Run CI in docker image

parent 78ce7b42
......@@ -2,57 +2,57 @@
image: gitlab.kwant-project.org:5005/zesje/zesje/test:latest
stages:
- build-env
- build
- test
# Special hidden job that is merged with JS jobs
.node_modules: &node_modules
# Cache the JS modules that yarn fetches
cache:
untracked: true
paths:
- .yarn-cache
before_script:
- source activate zesje-dev
- yarn install --cache-folder .yarn-cache
variables:
TEST_IMAGE: CI_REGISTRY_IMAGE/test:${CI_COMMIT_REF_SLUG}
.python_packages: &python_packages
build-image:
stage: build-env
image:
name: gcr.io/kaniko-project/executor:debug-v0.16.0
entrypoint: [""]
artifacts:
untracked: true
expire_in: 1 hour
before_script:
- source activate zesje-dev
- conda env update
build:
<<: *node_modules
stage: build
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script:
- python3 -m compileall zesje
- yarn build
artifacts:
paths:
- zesje/static
expire_in: 1 week
- mkdir docker
- cp Dockerfile docker/
- cp environment.yml docker/
- cp package.json docker/
- /kaniko/executor
--context $CI_PROJECT_DIR/docker
--dockerfile $CI_PROJECT_DIR/docker/Dockerfile
--destination $TEST_IMAGE
--cache=true
test_js:
<<: *node_modules
image: $TEST_IMAGE
stage: test
script: yarn test:js
script:
- yarn test:js
lint_js:
<<: *node_modules
image: $TEST_IMAGE
stage: test
allow_failure: true
script:
- yarn lint:js
lint_py:
<<: *python_packages
image: $TEST_IMAGE
stage: test
allow_failure: true
script:
- yarn lint:py
test_py:
<<: *python_packages
image: $TEST_IMAGE
stage: test
script:
- yarn test:py:cov
......
......@@ -12,13 +12,21 @@ RUN apt-get update && \
WORKDIR /app
ADD environment.yml /app/environment.yml
# Setup PYTHON packages
ADD environment.yml .
RUN conda env create
# From https://medium.com/@chadlagore/conda-environments-with-docker-82cdc9d25754
RUN echo "source activate $(head -1 /app/environment.yml | cut -d' ' -f2)" > ~/.bashrc
ENV PATH /opt/conda/envs/$(head -1 /app/environment.yml | cut -d' ' -f2)/bin:$PATH
RUN echo "source activate zesje-dev" > ~/.bashrc
ENV PATH /opt/conda/envs/zesje-dev/bin:$PATH
RUN rm environment.yml
# Setup YARN packages
RUN rm /app/environment.yml
ADD package.json .
RUN yarn install
RUN rm package.json
CMD bash
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment