Commit 22727f36 authored by Aron Fiechter's avatar Aron Fiechter
Browse files

Add .gitlab-ci.yml with single stage for build jobs

For now, use Dockerhub as registry.
parent 6041d04a
Pipeline #877 canceled with stage
image: docker:stable
services:
- docker:dind
variables:
BACKEND_DIR: api
FRONTEND_DIR: client
NODE_IMAGE: node:14.8.0
IMAGE_TAG_LATEST_FRONTEND: mimir-client:latest
IMAGE_TAG_LATEST_BACKEND: mimir-api:latest
stages:
- deploy
# Cache node modules in between builds
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
# backend dependencies
- $BACKEND_DIR/node_modules
# frontend dependencies
- $FRONTEND_DIR/node_modules
###################################################################################################
# Deploy stage jobs
deploy backend:
stage: deploy
script:
- docker info
- docker build
-t $IMAGE_TAG_LATEST_BACKEND
-f $BACKEND_DIR/Dockerfile
./$BACKEND_DIR
- docker image ls
- echo "$REGISTRY_PASSWORD" | docker login $REGISTRY_USER --username $CI_REGISTRY_USER --password-stdin
- docker tag $IMAGE_TAG_LATEST_BACKEND $REGISTRY_USER/$IMAGE_TAG_LATEST_BACKEND
- docker push $REGISTRY_USER/$IMAGE_TAG_LATEST_BACKEND
only:
changes:
- api/**
- api/**/*
refs:
- master
deploy frontend:
stage: deploy
script:
- docker info
- docker build
-t $IMAGE_TAG_LATEST_FRONTEND
-f $FRONTEND_DIR/Dockerfile
./$FRONTEND_DIR
- docker image ls
- echo "$REGISTRY_PASSWORD" | docker login $REGISTRY_USER --username $CI_REGISTRY_USER --password-stdin
- docker tag $IMAGE_TAG_LATEST_FRONTEND $REGISTRY_USER/$IMAGE_TAG_LATEST_FRONTEND
- docker push $REGISTRY_USER/$IMAGE_TAG_LATEST_FRONTEND
only:
changes:
- client/**
- client/**/*
refs:
- master
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment