count-anything/.gitlab-ci.yml
Louis Vallat 4db7b8f3b8
feat: dockerized rails app
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
2023-04-06 20:58:58 +02:00

35 lines
951 B
YAML

image: docker:latest
services:
- docker:dind
stages:
- release
variables:
# Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
CONTAINER_BRANCH_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
release:
stage: release
script:
- sed -i "s/__VERSION__/${CI_COMMIT_SHORT_SHA}/" src/_footer.html
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $CONTAINER_BRANCH_IMAGE
- docker push $CONTAINER_BRANCH_IMAGE
except:
- master
release-master:
stage: release
script:
- sed -i "s/__VERSION__/${CI_COMMIT_SHORT_SHA}/" src/_footer.html
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build . -t $CONTAINER_RELEASE_IMAGE
- docker push $CONTAINER_RELEASE_IMAGE
only:
- master