.gitlab-ci.yml 630 Bytes
Newer Older
Nane Kratzke's avatar
Nane Kratzke committed
1
2
3
4
5
6
7
8
9
stages:
    - test
    - build

services:
  - docker:dind

test:
    stage: test
Nane Kratzke's avatar
Nane Kratzke committed
10
    #image: "python:3.9"
Nane Kratzke's avatar
Nane Kratzke committed
11
12
13
14
15
16
17
18
19
20
21
22
23
    script:
    - docker build -t web:test .
    - docker run -d -p 80:80 web:test
    - python -m pip install -r unit/Requirements.txt
    - python unit/tests.py http://localhost "Hello from Docker Container"

build:
    stage: build
    script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker build -t $CI_REGISTRY_IMAGE/web:$CI_COMMIT_SHA -t $CI_REGISTRY_IMAGE/web:latest .
    - docker push $CI_REGISTRY_IMAGE/web:$CI_COMMIT_SHA
    - docker push $CI_REGISTRY_IMAGE/web:latest