Update .gitlab-ci.yml file

This commit is contained in:
Dagger 2022-05-25 00:20:38 +00:00
parent 982b93583b
commit cd258a40b8

View File

@ -1,22 +1,7 @@
docker-build: build-test:
image: docker:latest image: python:3.9
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- | - python --version
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then - pip --version
tag="" - pip install ./requirements.txt
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" - uvicorn app:app --host 0.0.0.0 --port 80
else
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- docker push "$CI_REGISTRY_IMAGE${tag}"
rules:
- if: $CI_COMMIT_BRANCH
exists:
- Dockerfile