forked from jarnovanleeuwen/laravel-dock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
37 lines (31 loc) · 857 Bytes
/
.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
image: tmaier/docker-compose:latest
services:
- docker:dind
stages:
- build
- release
variables:
APP_TAG: app-local
TEST_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
RELEASE_TAG: $CI_REGISTRY_IMAGE:latest
BUILD_DIR: build/
before_script:
- docker --version
- docker-compose --version
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
build:
stage: build
script:
- docker pull $RELEASE_TAG || true
- docker build --cache-from $RELEASE_TAG --file $BUILD_DIR/Dockerfile --target production --tag $TEST_TAG .
- docker tag $TEST_TAG $APP_TAG
- docker-compose -f $BUILD_DIR/docker-compose.test.yml run sut
- docker push $TEST_TAG
release:
stage: release
script:
- docker pull $TEST_TAG
- docker tag $TEST_TAG $RELEASE_TAG
- docker push $RELEASE_TAG
only:
- master