Skip to content

Commit 316d6ed

Browse files
committed
Add docker hub publishing via circleci
1 parent e16d8e5 commit 316d6ed

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

.circleci/config.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: 2.1
2+
executors:
3+
docker-publisher:
4+
environment:
5+
IMAGE_NAME: tedivm/gitconsensus_service
6+
docker:
7+
- image: circleci/buildpack-deps:stretch
8+
jobs:
9+
build:
10+
executor: docker-publisher
11+
steps:
12+
- checkout
13+
- setup_remote_docker
14+
- run:
15+
name: Build Docker image
16+
command: |
17+
docker build -t $IMAGE_NAME:latest .
18+
- run:
19+
name: Archive Docker image
20+
command: docker save -o image.tar $IMAGE_NAME
21+
- persist_to_workspace:
22+
root: .
23+
paths:
24+
- ./image.tar
25+
publish-latest:
26+
executor: docker-publisher
27+
steps:
28+
- attach_workspace:
29+
at: /tmp/workspace
30+
- setup_remote_docker
31+
- run:
32+
name: Load archived Docker image
33+
command: docker load -i /tmp/workspace/image.tar
34+
- run:
35+
name: Publish Docker Image to Docker Hub
36+
command: |
37+
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
38+
docker push $IMAGE_NAME:latest
39+
workflows:
40+
version: 2
41+
build-master:
42+
jobs:
43+
- build:
44+
filters:
45+
branches:
46+
only: master
47+
- publish-latest:
48+
requires:
49+
- build
50+
filters:
51+
branches:
52+
only: master

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.git
2+
venv
3+
build
4+
dist
5+
*.pem

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ testenv: clean_testenv
1616
clean_testenv:
1717
docker-compose down
1818

19+
build_image:
20+
docker build -f $(ROOT_DIR)/dockerfile -t tedivm/gitconsensus_service:latest .
21+
22+
publish_image: build_image
23+
docker push tedivm/gitconsensus_service:latest
24+
1925
dependencies:
2026
if [ ! -d $(ROOT_DIR)/venv ]; then python3 -m venv $(ROOT_DIR)/venv; fi
2127
source $(ROOT_DIR)/venv/bin/activate; python -m pip install wheel; yes w | python -m pip install -e .

0 commit comments

Comments
 (0)