Skip to content
Snippets Groups Projects
Verified Commit 424f7651 authored by Teemu Autto's avatar Teemu Autto
Browse files

Simplified build pipeline.

parent 0961c858
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ cache: ...@@ -20,7 +20,7 @@ cache:
variables: variables:
## Name for the generated image. Change this if you wish, but watch out ## Name for the generated image. Change this if you wish, but watch out
## for special characters! ## for special characters!
IMAGE_NAME: tjts5901 APP_IMAGE_NAME: ${DOCKER_REGISTRY}/tjts5901
## (Optional) More verbose output from pipeline ## (Optional) More verbose output from pipeline
#CI_DEBUG_TRACE: "true" #CI_DEBUG_TRACE: "true"
...@@ -39,11 +39,22 @@ variables: ...@@ -39,11 +39,22 @@ variables:
## Build docker image ## Build docker image
build: build:
image: docker:stable
stage: build stage: build
before_script:
## Make some checks that Docker credentials are configured.
- test -z "${DOCKER_REGISTRY}" && (echo "Missing required variable DOCKER_REGISTRY. See 'Pipeline setup.md'"; exit 1)
- test -z "${DOCKER_AUTH_CONFIG}" && (echo "Missing required variable DOCKER_AUTH_CONFIG. See 'Pipeline setup.md'"; exit 1)
script: script:
## Build a new image, pulling the latest base, and tag it. ## Build a new image, pulling the latest base, and tag it.
## If --pull is ommited, base from local is used. ## If --pull is ommited, base from local is used.
- docker build --pull -t $IMAGE_NAME . - docker build --pull -t $APP_IMAGE_NAME .
## Tag the build image for registry, and push it.
#- docker tag "${APP_IMAGE_NAME}" "${DOCKER_REGISTRY}:${APP_IMAGE_NAME}"
- docker push "${DOCKER_REGISTRY}:${APP_IMAGE_NAME}"
## Build course documentation. You might not need this stage. ## Build course documentation. You might not need this stage.
pages: pages:
...@@ -52,7 +63,7 @@ pages: ...@@ -52,7 +63,7 @@ pages:
## Use build from previous stage as base image. ## Use build from previous stage as base image.
dependencies: dependencies:
- build - build
image: $IMAGE_NAME image: $APP_IMAGE_NAME
script: script:
## Install `mkdocs` and generate HTML documentation. ## Install `mkdocs` and generate HTML documentation.
...@@ -70,19 +81,3 @@ pages: ...@@ -70,19 +81,3 @@ pages:
## Mark this stage as an "production" environment. ## Mark this stage as an "production" environment.
environment: production environment: production
## Push image to container registry
push-image:
stage: deploy
dependencies:
- build
image: docker:stable
before_script:
## Make some checks that Docker credentials are configured.
- test -z "${DOCKER_REGISTRY}" && (echo "Missing required variable DOCKER_REGISTRY. See 'Pipeline setup.md'"; exit 1)
- test -z "${DOCKER_AUTH_CONFIG}" && (echo "Missing required variable DOCKER_AUTH_CONFIG. See 'Pipeline setup.md'"; exit 1)
script:
## Tag the build image for registry, and push it.
- docker tag "${IMAGE_NAME}" "${DOCKER_REGISTRY}:${IMAGE_NAME}"
- docker push "${DOCKER_REGISTRY}:${IMAGE_NAME}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment