-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy path.gitlab-ci.yml
63 lines (58 loc) · 1.86 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
image: docker:latest
variables:
PROJECT_NAME: "{{ name }}"
GROUP_NAME: "{{ organization }}"
# This is a base job template for all `docker`-based jobs. It won't be executed.
.docker:
image: docker:latest
variables:
# When using dind, it's wise to use the overlayfs driver for
# improved performance:
DOCKER_DRIVER: overlay2
REGISTRY: "registry.gitlab.com"
CONTAINER_RELEASE_IMAGE: "$REGISTRY/$GROUP_NAME/$PROJECT_NAME:latest"
services:
- docker:dind
before_script:
# Installing global dependencies:
- apk update && apk upgrade
- apk add python3 python3-dev py3-pip git build-base
- pip3 install dump-env docker-image-size-limit 'docker-compose<1.24'
# Creating `.env` configuration file:
- dump-env -t config/.env.template -p 'SECRET_' > config/.env
# Login into Docker registry:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$REGISTRY"
# Debug information:
- docker info && docker-compose --version && git --version
# Testing application:
test:
extends: .docker
stage: test
script:
- docker-compose run --rm vue npm run ci
coverage: '/All files\s*\|\s*([\d\.]+)/'
only:
- merge_requests
# QA job to run during test. It is started manually:
qa:
extends: .docker
stage: test
script:
- apk add curl
- docker-compose build && docker-compose up -d
- BASE_TEST_URL="http://docker:3000" sh docker/testcafe/qa.sh
when: manual
# Releasing image, when in `master` branch,
# can be replaced with `kira-release` bot:
# https://github.com/wemake-services/kira-release
release-image:
extends: .docker
stage: deploy
script:
- docker build -t "$CONTAINER_RELEASE_IMAGE"
--build-arg NODE_ENV=production -f docker/vue/Dockerfile .
- docker push "$CONTAINER_RELEASE_IMAGE"
only:
- master
environment:
name: production # used to track time with 'cycle analytics'