Skip to content
Snippets Groups Projects
Commit 35f614bc authored by Tadeusz Miesiąc's avatar Tadeusz Miesiąc
Browse files

chore(build on ci): build next.js docker image on ci

parent 218c9f3c
No related branches found
No related tags found
2 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!3Development
Pipeline #78364 failed
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
#
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
#
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
default: default:
image: node:16.16.0 image: node:16.16.0
variables:
# enable docker buildkit. Used with `BUILDKIT_INLINE_CACHE=1` below
DOCKER_BUILDKIT: 1
DOCKER_TLS_CERTDIR: '/certs'
IMAGE_TEST: $CI_REGISTRY_IMAGE/test:latest
#IMAGE_CYPRESS: $CI_REGISTRY_IMAGE/cypress:latest
IMAGE_DEPLOY: $CI_REGISTRY_IMAGE/deploy:latest
stages: stages:
- lint
- test
- build - build
- misc
- deploy - deploy
cache: cache:
paths: paths:
- ~/.cache - ~/.cache
variables:
DOCKER_DRIVER: overlay2
lint:commit: .base:
stage: lint image: docker:latest
services:
- docker:dind
before_script:
- docker --version
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
build:builder:
extends: .base
stage: build
script: script:
- npm install - docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from "$IMAGE_TEST" --target builder -t "$IMAGE_TEST" .
- echo "${CI_COMMIT_MESSAGE}" | npx commitlint - docker push "$IMAGE_TEST"
deploy_staging: build:deployimage:
stage: deploy extends: .base
environment: staging stage: misc
except: needs: ['build:builder']
- main
script: script:
- npm install --global vercel - docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from "$IMAGE_DEPLOY" --cache-from "$IMAGE_TEST" --cache-from "$IMAGE_CYPRESS" -t "$IMAGE_DEPLOY" .
- vercel pull --yes --environment=preview --token=$VERCEL_TOKEN - docker push "$IMAGE_DEPLOY"
- vercel build --token=$VERCEL_TOKEN
- vercel deploy --prebuilt --token=$VERCEL_TOKEN
rules:
- if: $CI_COMMIT_BRANCH == "develop"
when: never
- if: $CI_COMMIT_BRANCH
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