Skip to content

Commit

Permalink
Merge pull request #46 from Fgerthoffert/develop
Browse files Browse the repository at this point in the history
Added docker image build
  • Loading branch information
Fgerthoffert authored Aug 17, 2020
2 parents 15514c4 + 292f6ee commit b548a19
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
version: 2.1

executors:
docker-publisher:
environment:
IMAGE_NAME: fgerthoffert/jahia-cli
docker:
- image: circleci/buildpack-deps:stretch

references:
workdir: &workdir
working_directory: ~/source
Expand Down Expand Up @@ -158,6 +165,47 @@ jobs:
name: Manually installing a module
command: jahia-cli modules:install --file=/tmp/addstuff-1.3.jar --id=addstuff

docker-build:
executor: docker-publisher
steps:
- checkout
- setup_remote_docker
- run:
name: Build Docker image from Circleci base
command: |
docker build -t $IMAGE_NAME:latest .
- run:
name: Archive Docker image
command: |
docker save -o image_latest.tar $IMAGE_NAME:latest
- persist_to_workspace:
root: .
paths:
- ./image_latest.tar

docker-publish:
executor: docker-publisher
steps:
- attach_workspace:
at: /tmp/workspace
- setup_remote_docker
- run:
name: Load archived Latest Docker image
command: docker load -i /tmp/workspace/image_latest.tar
- run:
name: Publish Latest Docker Image to Docker Hub
command: |
echo "$DOCKERHUB_USERNAME"
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
IMAGE_TAG=${CIRCLE_TAG/v/''}
echo "Image tag is: $IMAGE_TAG"
docker tag $IMAGE_NAME:latest $IMAGE_NAME_API:$IMAGE_TAG
echo "Tagged the image"
docker push $IMAGE_NAME:latest
echo "Pushed latest"
docker push $IMAGE_NAME:$IMAGE_TAG
echo "Pushed tag"
workflows:
version: 2
build-npm:
Expand Down

0 comments on commit b548a19

Please sign in to comment.