Skip to content

Add circle-ci #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: 2
jobs:
shellcheck:
docker:
- image: nlknguyen/alpine-shellcheck:v0.4.6
steps:
- checkout
- run:
name: Check Docker Hub Hooks
command: |
find hooks -type f | wc -l
find hooks -type f | xargs shellcheck -e SC2086 --external-sources
- run:
name: Check Scripts
command: |
find . -type f -name '*.sh' | wc -l
find . -type f -name '*.sh' | xargs shellcheck -e SC2086 -e SC1090 --external-sources
build:
docker:
- image: circleci/golang:1.11.5
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Create docker image
command: make build

build-deploy:
docker:
- image: circleci/golang:1.11.5
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Create docker image
command: make build
- run:
name: Logg into Docker registry
command: docker login -u $docker_release_user -p $docker_release_password
- run:
name: Publish docker image
command: make push

release:
docker:
- image: circleci/golang:1.11.5
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Login to public Docker HUB
command: |
docker login -u $docker_release_user -p $docker_release_password
make release

workflows:
version: 2
verify:
jobs:
- shellcheck
- build
deploy:
jobs:
- build-deploy:
requires:
- shellcheck
filters:
branches:
only:
- master
release:
jobs:
- release:
filters:
tags:
only: /^([0-9]\d*)\.([0-9]\d*)\.([0-9]\d*).*$/
branches:
ignore: /.*/
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
DOCKER_RELEASE_REG=solidnerd
DOCKER_IMAGE=bookstack


DOCKER_INTERNAL_TAG := $(shell git rev-parse --short HEAD)
DOCKER_RELEASE_TAG := $(shell git describe)
BUILD_DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
VCS_URL := https://github.com/solidnerd/docker-bookstack

.PHONY: build push pull release

build:
docker image build . \
-t $(DOCKER_RELEASE_REG)/$(DOCKER_IMAGE):$(DOCKER_INTERNAL_TAG) \
--build-arg VCS_REF=$(DOCKER_INTERNAL_TAG) \
--build-arg BUILD_DATE=$(BUILD_DATE) \
--build-arg VCS_URL=$(VCS_URL)

push:
docker push $(DOCKER_RELEASE_REG)/$(DOCKER_IMAGE):$(DOCKER_INTERNAL_TAG)

pull:
docker pull $(DOCKER_RELEASE_REG)/$(DOCKER_IMAGE):$(DOCKER_INTERNAL_TAG)

release:
docker tag $(DOCKER_RELEASE_REG)/$(DOCKER_IMAGE):$(DOCKER_INTERNAL_TAG) $(DOCKER_RELEASE_REG)/$(DOCKER_IMAGE):$(DOCKER_RELEASE_TAG)
docker tag $(DOCKER_RELEASE_REG)/$(DOCKER_IMAGE):$(DOCKER_INTERNAL_TAG) $(DOCKER_RELEASE_REG)/$(DOCKER_IMAGE):latest

docker push $(DOCKER_RELEASE_REG)/$(DOCKER_IMAGE):$(DOCKER_RELEASE_TAG)
docker push $(DOCKER_RELEASE_REG)/$(DOCKER_IMAGE):latest