Merge branch 'docker' into 'main'

Update Docker setup

See merge request interactivetextbooks-citg/jupyter-book-manual!30
This commit is contained in:
Caspar Jungbacker 2023-08-13 19:42:51 +02:00
commit 30c6674024
2 changed files with 13 additions and 32 deletions

View file

@ -33,44 +33,20 @@ test-build:
build-book:
stage: build
rules:
- if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push"
before_script:
- python -V
- conda env create -f environment.yml
- conda init bash
- source ~/.bashrc
- conda activate jupyter-book-env
script:
- jupyter-book clean book/
- jupyter-book build book/
artifacts:
expire_in: 30 days
paths:
- book/_build/html/
build-container:
image: docker
stage: build
rules:
- if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push"
needs:
- build-book
before_script:
- docker info
script:
- docker build -t $TAG_COMMIT -t $TAG_LATEST .
- docker push $TAG_COMMIT
- docker build -t $TAG_LATEST
- docker push $TAG_LATEST
update-website:
image: docker
deploy-book:
stage: deploy
image: docker
rules:
- if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push"
script:
- docker-compose pull $CI_PROJECT_NAME
- docker-compose up -d
environment:
name: production
url: https://interactivetextbooks.citg.tudelft.nl/
- docker compose -f /etc/web_server/docker-compose.yml pull
- docker compose -f /etc/web_server/docker-compose.yml up -d --no-deps manual

View file

@ -1,3 +1,8 @@
FROM httpd:latest
COPY ./book/_build/html /usr/local/apache2/htdocs
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 build .
ENTRYPOINT [ "python", "-m", "http.server", "8000", "--directory", "_build/html" ]