31 lines
979 B
YAML
31 lines
979 B
YAML
docker:
|
|
variables:
|
|
VERSION: latest
|
|
DOCKER_HOST: tcp://docker:2375
|
|
|
|
stage: build
|
|
|
|
image: docker:latest
|
|
services:
|
|
- docker:dind
|
|
|
|
before_script:
|
|
- docker info && docker version
|
|
- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
|
|
- if [ -n "$GITHUB_TOKEN" ]; then cat $GITHUB_TOKEN |base64 -d > auth.json; fi
|
|
|
|
script:
|
|
- if [ ! -d docker ]; then mkdir docker; fi
|
|
- if [ -f init ]; then chmod 500 init; fi
|
|
- ([ -z "$REFRESH" -a -f docker/${CI_COMMIT_REF_SLUG} ]) && docker load < docker/${CI_COMMIT_REF_SLUG} || true
|
|
- echo -n ${CI_COMMIT_SHORT_SHA} > VERSION
|
|
- rm -rf vendor/ database/schema database/seeders database/factories/*
|
|
- docker build --cache-from ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${VERSION} .
|
|
- docker push ${CI_REGISTRY_IMAGE}:${VERSION}
|
|
- docker save ${CI_REGISTRY_IMAGE}:${VERSION} > docker/${CI_COMMIT_REF_SLUG}
|
|
tags:
|
|
- docker
|
|
- x86_64
|
|
only:
|
|
- master
|