diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43a20fa9523bd6a8dcd289c6f061a9f3d2c5105f..ddc9c08826a3a3967ab597b67bd0307651134e4a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,27 +1,22 @@ -# image: python:3.10-buster -image: harbor.wolke.img.univie.ac.at/podman/mkdocs-computer:latest - -# variables: -# PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - -# Cache between jobs in the same branch -cache: - - key: $CI_COMMIT_REF_SLUG -# - paths: -# - .cache/pip - stages: - build - deploy +create-image: + image: quay.io/podman/stable + stage: build + rules: + - changes: + - Dockerfile + - requirements.txt + script: + - podman build -t registry.phaidra.org/imgw/computer-resources:latest . + - podman login registry.phaidra.org -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD + - podman push registry.phaidra.org/imgw/computer-resources:latest + build: + image: $CI_REGISTRY/imgw/computer-resources:latest stage: build - # when: manual - # before_script: - # Install all required packages - # - apt-get update -y - # - apt-get install -y -qq graphviz - # - pip install -r requirements.txt script: # --strict is too strict :) - mkdocs build -c --verbose @@ -29,16 +24,17 @@ build: expire_in: 1 hour paths: - site/ - + cache: + - key: $CI_COMMIT_REF_SLUG deploy: + image: $CI_REGISTRY/imgw/computer-resources:latest stage: deploy # when: manual rules: - if: '$CI_COMMIT_REF_NAME == "master"' needs: - build - # before_script: - # - apt-get update -qq && apt-get install -y -qq sshpass openssh-client rsync script: - # - sshpass -p "$WOLKE_PASSWORD" scp -oStrictHostKeyChecking=no -r ./site/* $WOLKE_USER@wolke.img.univie.ac.at:/var/www/html/documentation/general/ - - sshpass -p "$WOLKE_PASSWORD" rsync -autv --delete -e "ssh -o StrictHostKeyChecking=no" ./site/ $WOLKE_USER@wolke.img.univie.ac.at:/var/www/html/documentation/general \ No newline at end of file + - sshpass -p "$WOLKE_PASSWORD" rsync -autv --delete -e "ssh -o StrictHostKeyChecking=no" ./site/ $WOLKE_USER@wolke.img.univie.ac.at:/var/www/html/documentation/general + cache: + - key: $CI_COMMIT_REF_SLUG \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ff91c80d38cb9312e0658be9b177f17be1c61370..2eafe67734071d25fded41fb5668dfd639436d7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,22 @@ -FROM python:3.10-buster +FROM python:3.10-slim ADD requirements.txt /requirements.txt RUN apt-get update -y \ && apt-get install -y -qq graphviz sshpass openssh-client rsync \ - && pip install -r requirements.txt -WORKDIR /app -ADD . /app -EXPOSE 8000 -CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"] \ No newline at end of file + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /tmp/* /var/tmp/* +RUN pip install --no-cache-dir -r requirements.txt +# WORKDIR /app +# ADD . /app +# EXPOSE 8000 +# CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"] + +# this is a larger image? +# FROM python:3.10-alpine +# ADD requirements.txt /requirements.txt +# RUN apk add --update graphviz sshpass openssh-client rsync gcc python3-dev musl-dev linux-headers\ +# && pip install --no-cache-dir -r requirements.txt +# WORKDIR /app +# ADD . /app +# EXPOSE 8000 +# CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"] \ No newline at end of file