my-homepage/.gitlab-ci.yml

40 lines
706 B
YAML
Raw Normal View History

2021-12-23 03:10:02 +00:00
image: docker:19.03.12
2021-02-28 01:40:10 +00:00
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
2021-02-28 16:17:51 +00:00
CI_DEBUG_TRACE: "true"
2021-12-23 03:10:02 +00:00
REPO: docker.shillerben.com
TAG: latest
2021-02-28 01:40:10 +00:00
cache:
paths:
2021-12-23 03:10:02 +00:00
- .cache/pip
2021-02-28 01:40:10 +00:00
2021-12-23 03:11:48 +00:00
stages:
- test
- build
- push
2021-02-28 01:40:10 +00:00
test:
2021-12-23 03:10:02 +00:00
stage: test
before_script:
- apt-get update && apt-get install python3
- python3 -V
- python3 -m pip install -r requirements.txt
- python3 -m pip install pytest
2021-02-28 01:40:10 +00:00
script:
2021-12-23 03:10:02 +00:00
- pytest
2021-02-28 01:40:10 +00:00
2021-12-23 03:11:48 +00:00
build:
2021-12-23 03:10:02 +00:00
stage: build
2021-02-28 01:40:10 +00:00
script:
2021-12-23 03:10:02 +00:00
- docker build -t my_homepage .
2021-02-28 01:40:10 +00:00
2021-12-23 03:10:02 +00:00
push:
stage: push
2021-02-28 01:40:10 +00:00
script:
2021-12-23 03:10:02 +00:00
- docker tag my_homepage $REPO/my_homepage:$TAG
- docker push $REPO/my_homepage:$TAG