mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Update circle ci config
This commit is contained in:
parent
75112f3dc4
commit
005b74eb65
1 changed files with 26 additions and 65 deletions
|
|
@ -8,7 +8,7 @@ executors:
|
||||||
orbs:
|
orbs:
|
||||||
ruby: circleci/ruby@2.1.4
|
ruby: circleci/ruby@2.1.4
|
||||||
browser-tools: circleci/browser-tools@1.4.8
|
browser-tools: circleci/browser-tools@1.4.8
|
||||||
docker: circleci/docker@2.2.1
|
docker: circleci/docker@2.8.2
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
|
@ -43,69 +43,29 @@ jobs:
|
||||||
path: coverage
|
path: coverage
|
||||||
|
|
||||||
build-and-push:
|
build-and-push:
|
||||||
docker:
|
executor:
|
||||||
- image: cimg/node:current
|
name: docker/docker
|
||||||
environment:
|
# You can also specify a different image if required.
|
||||||
DOCKER_CLI_EXPERIMENTAL: enabled
|
parameters:
|
||||||
|
tag:
|
||||||
|
type: string
|
||||||
|
default: "rc"
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
# Login to Docker Hub using the orb command. The orb expects environment
|
||||||
- run:
|
# variables DOCKERHUB_USERNAME and DOCKERHUB_PASSWORD (or DOCKERHUB_TOKEN).
|
||||||
name: Set branch variable
|
|
||||||
command: |
|
|
||||||
if [ -z "$CIRCLE_BRANCH" ]; then
|
|
||||||
echo 'export BUILD_BRANCH=master' >> $BASH_ENV
|
|
||||||
else
|
|
||||||
echo "export BUILD_BRANCH=$CIRCLE_BRANCH" >> $BASH_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- setup_remote_docker:
|
|
||||||
version: 20.10.24
|
|
||||||
docker_layer_caching: true
|
|
||||||
|
|
||||||
- run:
|
|
||||||
name: Install dependencies
|
|
||||||
command: npm install
|
|
||||||
|
|
||||||
- docker/login:
|
- docker/login:
|
||||||
username: << pipeline.parameters.DOCKERHUB_USERNAME >>
|
username: "$DOCKERHUB_USERNAME"
|
||||||
password: << pipeline.parameters.DOCKERHUB_TOKEN >>
|
password: "$DOCKERHUB_TOKEN"
|
||||||
|
# Build and publish the Docker image.
|
||||||
- run:
|
- docker/build-publish:
|
||||||
name: Set Docker tags
|
image: "freikin/dawarich:<< parameters.tag >>"
|
||||||
command: |
|
dockerfile: ./docker/Dockerfile.dev
|
||||||
if [[ -n "$CIRCLE_TAG" ]]; then
|
# Set additional options if needed:
|
||||||
VERSION="${CIRCLE_TAG}"
|
build-args: ""
|
||||||
else
|
extra-build-args: "--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6"
|
||||||
VERSION="latest"
|
registry: "docker.io"
|
||||||
fi
|
push: true
|
||||||
|
|
||||||
TAGS="freikin/dawarich:${VERSION}"
|
|
||||||
|
|
||||||
if [[ "$CIRCLE_TAG" =~ rc ]]; then
|
|
||||||
TAGS="${TAGS},freikin/dawarich:rc"
|
|
||||||
else
|
|
||||||
TAGS="${TAGS},freikin/dawarich:latest"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "export DOCKER_TAGS=\"$TAGS\"" >> $BASH_ENV
|
|
||||||
|
|
||||||
- run:
|
|
||||||
name: Build and push (arm64)
|
|
||||||
command: |
|
|
||||||
docker buildx create --use
|
|
||||||
docker buildx build --platform linux/arm64 \
|
|
||||||
--file ./docker/Dockerfile.dev \
|
|
||||||
--tag freikin/dawarich:${VERSION} \
|
|
||||||
--push .
|
|
||||||
|
|
||||||
- run:
|
|
||||||
name: Build and push (other architectures)
|
|
||||||
command: |
|
|
||||||
docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm/v6 \
|
|
||||||
--file ./docker/Dockerfile.dev \
|
|
||||||
--tag freikin/dawarich:${VERSION} \
|
|
||||||
--push .
|
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
|
@ -113,10 +73,11 @@ workflows:
|
||||||
jobs:
|
jobs:
|
||||||
- test
|
- test
|
||||||
- build-and-push:
|
- build-and-push:
|
||||||
|
requires:
|
||||||
|
- test
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
only:
|
ignore: /.*/ # Ignore branches; run only on tag builds (or adjust as needed)
|
||||||
- master
|
|
||||||
- dev
|
|
||||||
tags:
|
tags:
|
||||||
only: /.*/ # Match ANY tag name
|
only: /.*/ # Run for any tag; adjust regex if you want more specific tag matching
|
||||||
|
tag: "<< pipeline.parameters.tag >>"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue