2023-01-10 14:28:19 +00:00
|
|
|
image: docker:20.10.22
|
|
|
|
|
|
|
|
stages:
|
2023-04-05 10:05:19 +00:00
|
|
|
|
2023-02-09 13:20:05 +00:00
|
|
|
- build
|
2023-01-10 14:28:19 +00:00
|
|
|
|
|
|
|
|
2023-02-09 13:20:05 +00:00
|
|
|
|
|
|
|
###############
|
|
|
|
# BUILD STAGE #
|
|
|
|
###############
|
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
image: docker:20.10.22
|
|
|
|
variables:
|
2023-03-30 08:28:20 +00:00
|
|
|
DOCKER_TLS_CERTDIR: ''
|
2023-02-09 13:20:05 +00:00
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
before_script:
|
2023-04-04 09:59:05 +00:00
|
|
|
- echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
|
2023-02-09 13:20:05 +00:00
|
|
|
script:
|
2023-04-04 10:27:40 +00:00
|
|
|
- export VERSION=$(docker run --rm -v "$PWD":/usr/src/app:ro -w /usr/src/app node:slim node -p "require('./package.json').version")
|
2023-04-05 09:55:20 +00:00
|
|
|
- echo $VERSION
|
2023-04-04 09:59:05 +00:00
|
|
|
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
|
|
|
- >
|
|
|
|
docker build
|
|
|
|
--pull
|
|
|
|
--cache-from $CI_REGISTRY_IMAGE:latest
|
2023-04-04 10:43:27 +00:00
|
|
|
--tag $CI_REGISTRY_IMAGE:$VERSION
|
|
|
|
--tag $CI_REGISTRY_IMAGE:latest
|
2023-04-04 09:59:05 +00:00
|
|
|
.
|
2023-04-05 09:55:20 +00:00
|
|
|
- docker image ls
|
2023-04-05 10:01:27 +00:00
|
|
|
- docker push $CI_REGISTRY_IMAGE:$VERSION
|
|
|
|
- docker push $CI_REGISTRY_IMAGE:latest
|
2023-02-09 13:20:05 +00:00
|
|
|
only:
|
|
|
|
- main
|