Skip to content

Commit

Permalink
Merge pull request #15 from peter-evans/circleci
Browse files Browse the repository at this point in the history
Add CircleCI build
  • Loading branch information
peter-evans authored Mar 5, 2019
2 parents 83dee61 + ac8687e commit 5d9b6dc
Show file tree
Hide file tree
Showing 23 changed files with 116 additions and 9 deletions.
107 changes: 107 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
version: 2.1
executors:
docker-executor:
environment:
IMAGE_NAME: peterevans/nominatim-k8s
NOMINATIM_PBF_URL: http://download.geofabrik.de/asia/maldives-latest.osm.pbf
docker:
- image: circleci/buildpack-deps:stretch
jobs:
build:
executor: docker-executor
environment:
IMAGE_TAG: latest
DOCKERFILE_PATH: .
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Build Docker image
command: |
docker build -t $IMAGE_NAME:$IMAGE_TAG $DOCKERFILE_PATH
- run:
name: Cache Docker image
command: docker save -o $IMAGE_TAG.tar $IMAGE_NAME
- persist_to_workspace:
root: .
paths:
- ./*.tar
test:
executor: docker-executor
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- setup_remote_docker
- run:
name: Load cached Docker image
command: |
docker load -i /tmp/workspace/latest.tar
- run:
name: Test Docker image
command: |
docker run -d -e NOMINATIM_PBF_URL=$NOMINATIM_PBF_URL --name nominatim-k8s $IMAGE_NAME:latest
# Dummy container to store tests
docker create -v /etc/newman --name tests alpine:3.4 /bin/true
docker cp tests/. tests:/etc/newman
# Run tests
docker run --network container:nominatim-k8s jwilder/dockerize -wait http://localhost:8080/search -timeout 300s -wait-retry-interval 5s
docker run --network container:nominatim-k8s --volumes-from tests -t postman/newman:4.4.0-alpine run nominatim.postman_collection.json
publish-tag:
executor: docker-executor
steps:
- attach_workspace:
at: /tmp/workspace
- setup_remote_docker
- run:
name: Load cached Docker image
command: |
docker load -i /tmp/workspace/latest.tar
- run:
name: Publish Docker Image to Docker Hub
command: |
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
IMAGE_TAG=${CIRCLE_TAG/v/''}
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$IMAGE_TAG
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$IMAGE_TAG
# If the minor version can be extracted then tag and push
MINOR_VERSION=$(echo $CIRCLE_TAG | sed -n "s/^v\([0-9]*.[0-9]*\).[0-9]*$/\1/p")
if [[ ${#MINOR_VERSION} -gt 0 ]]; then
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$MINOR_VERSION
docker push $IMAGE_NAME:$MINOR_VERSION
fi
workflows:
version: 2
build:
jobs:
- build
- test:
requires:
- build
build-and-publish-tags:
jobs:
- build:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- test:
requires:
- build
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
- publish-tag:
context: org-global
requires:
- test
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ services:

env:
global:
- RELEASE_VERSION=2.3
- NOMINATIM_PBF_URL="http://download.geofabrik.de/asia/maldives-latest.osm.pbf"

before_install:
Expand All @@ -12,7 +11,7 @@ before_install:
- docker --version

install:
- docker build -t nominatim-k8s ./$RELEASE_VERSION
- docker build -t nominatim-k8s .
- docker run -d -p 8080:8080 -e NOMINATIM_PBF_URL=$NOMINATIM_PBF_URL --name nominatim nominatim-k8s

before_script:
Expand Down
4 changes: 2 additions & 2 deletions 2.3/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM peterevans/trusty-gcloud:1.2.19 as builder
FROM peterevans/trusty-gcloud:1.2.22 as builder

MAINTAINER Peter Evans <[email protected]>

Expand Down Expand Up @@ -42,7 +42,7 @@ RUN cd /srv \
&& make


FROM peterevans/trusty-gcloud:1.2.19
FROM peterevans/trusty-gcloud:1.2.22

# Let the container know that there is no TTY
ARG DEBIAN_FRONTEND=noninteractive
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Nominatim for Kubernetes
[![](https://images.microbadger.com/badges/image/peterevans/nominatim-k8s.svg)](https://microbadger.com/images/peterevans/nominatim-k8s)
[![Build Status](https://travis-ci.org/peter-evans/nominatim-k8s.svg?branch=master)](https://travis-ci.org/peter-evans/nominatim-k8s)
[![CircleCI](https://circleci.com/gh/peter-evans/nominatim-k8s/tree/master.svg?style=svg)](https://circleci.com/gh/peter-evans/nominatim-k8s/tree/master)

[Nominatim](https://github.com/openstreetmap/Nominatim) for Kubernetes on Google Container Engine (GKE).

This Docker image and sample Kubernetes configuration files are one solution to persisting Nominatim data and providing immutable deployments.

## Supported tags and respective `Dockerfile` links

- [`2.3.1`, `2.3`, `latest` (*2.3/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master/2.3)
- [`2.2.0`, `2.2` (*2.2/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master/2.2)
- [`2.1.0`, `2.1` (*2.1/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master/2.1)
- [`2.0.1`, `2.0` (*2.0/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master/2.0)
- [`1.2.0`, `1.2` (*1.2/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master/1.2)
- [`2.3.2`, `2.3`, `latest` (*2.3/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master)
- [`2.2.0`, `2.2` (*2.2/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master/archive/2.2)
- [`2.1.0`, `2.1` (*2.1/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master/archive/2.1)
- [`2.0.1`, `2.0` (*2.0/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master/archive/2.0)
- [`1.2.0`, `1.2` (*1.2/Dockerfile*)](https://github.com/peter-evans/nominatim-k8s/tree/master/archive/1.2)

## Usage
The Docker image can be run standalone without Kubernetes:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5d9b6dc

Please sign in to comment.