mirror of
https://github.com/TeachBooks/template.git
synced 2026-11-12 22:25:52 +00:00
removed gitlab stuff and dockerfile
This commit is contained in:
parent
bffe3a562e
commit
d0c29d8c74
2 changed files with 0 additions and 84 deletions
|
|
@ -1,75 +0,0 @@
|
|||
stages:
|
||||
- test
|
||||
- build
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||
REGISTRY_HOST: localhost:5000
|
||||
TAG_LATEST: $REGISTRY_HOST/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME:latest
|
||||
TAG_DRAFT: $REGISTRY_HOST/$CI_PROJECT_NAME-draft/$CI_COMMIT_REF_NAME:latest
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .cache/pip
|
||||
|
||||
# This job tests if the book compiles gracefully after a new addition
|
||||
test-build:
|
||||
stage: test
|
||||
image: python:3.11-bullseye
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
script:
|
||||
- pip install -r requirements.txt
|
||||
- jupyter-book clean book/
|
||||
- jupyter-book build book/
|
||||
|
||||
# This job builds the Docker container
|
||||
build-book:
|
||||
stage: build
|
||||
image: docker
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push"
|
||||
variables:
|
||||
TAG: $TAG_LATEST
|
||||
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
|
||||
variables:
|
||||
TAG: $TAG_DRAFT
|
||||
before_script:
|
||||
- docker info
|
||||
script:
|
||||
- if [ "$TAG" = "$TAG_LATEST" ]; then sed --in-place=".bak" '/# START DRAFT/,/# END DRAFT/{//!d}' book/_config.yml; fi
|
||||
- docker build -t $TAG .
|
||||
- docker push $TAG
|
||||
|
||||
# This job takes down the existing container and starts the new one
|
||||
deploy-book:
|
||||
stage: deploy
|
||||
image: docker
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push"
|
||||
before_script:
|
||||
- docker info
|
||||
- docker stop $CI_PROJECT_NAME || exit_code=$?
|
||||
- if [ $exit_code -ne 0 ]; then echo "Container not found, cannot stop"; else docker rm $CI_PROJECT_NAME; fi
|
||||
script:
|
||||
- docker run -d --restart always -p 8019:8000 --name $CI_PROJECT_NAME $TAG_LATEST # Make sure to use a different port for each book!
|
||||
environment:
|
||||
name: production
|
||||
url: https://interactivetextbooks.citg.tudelft.nl/$CI_PROJECT_NAME
|
||||
|
||||
# Deploy the draft version of the book
|
||||
deploy-draft:
|
||||
stage: deploy
|
||||
image: docker
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
|
||||
before_script:
|
||||
- docker info
|
||||
- docker stop $CI_PROJECT_NAME-draft || exit_code=$?
|
||||
- if [ $exit_code -ne 0 ]; then echo "Container not found, cannot stop"; else docker rm $CI_PROJECT_NAME-draft; fi
|
||||
script:
|
||||
- docker run -d --restart always -p 8020:8000 --name $CI_PROJECT_NAME-draft $TAG_DRAFT
|
||||
environment:
|
||||
name: draft
|
||||
url: https://interactivetextbooks.citg.tudelft.nl/$CI_PROJECT_NAME-draft
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
FROM continuumio/miniconda3
|
||||
WORKDIR /book
|
||||
COPY book/ .
|
||||
RUN apt-get update && apt-get -y install git gcc
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip install -r requirements.txt
|
||||
RUN jupyter book clean .
|
||||
RUN jupyter book build .
|
||||
ENTRYPOINT [ "python", "-m", "http.server", "8000", "--directory", "/book/_build/html"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue