38 lines
852 B
YAML
38 lines
852 B
YAML
image: docker:20.10.22
|
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
|
|
|
|
###############
|
|
# BUILD STAGE #
|
|
###############
|
|
|
|
build:
|
|
stage: build
|
|
image: docker:20.10.22
|
|
variables:
|
|
DOCKER_TLS_CERTDIR: ''
|
|
services:
|
|
- docker:dind
|
|
before_script:
|
|
- echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
|
|
script:
|
|
- export VERSION=$(docker run --rm -v "$PWD":/usr/src/app:ro -w /usr/src/app node:slim node -p "require('./package.json').version")
|
|
- echo $VERSION
|
|
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
|
- >
|
|
docker build
|
|
--pull
|
|
--cache-from $CI_REGISTRY_IMAGE:latest
|
|
--tag $CI_REGISTRY_IMAGE:$VERSION
|
|
--tag $CI_REGISTRY_IMAGE:latest
|
|
.
|
|
- docker image ls
|
|
- docker push $CI_REGISTRY_IMAGE:$VERSION
|
|
- docker push $CI_REGISTRY_IMAGE:latest
|
|
only:
|
|
- main
|