-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f8a5c05
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
working_directory: /app | ||
docker: | ||
- image: docker:17.05.0-ce-git | ||
steps: | ||
- checkout | ||
- setup_remote_docker | ||
- run: | ||
name: Build and push image to Docker Hub | ||
command: sh .circleci/docker.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
set -u | ||
|
||
# collect params from ENV vars | ||
DATE=`date +%Y-%m-%d` | ||
DOCKER_REPOSITORY="pelias" | ||
DOCKER_PROJECT="${DOCKER_REPOSITORY}/${CIRCLE_PROJECT_REPONAME}" | ||
|
||
# skip builds on greenkeeper branches | ||
if [[ -z "${CIRCLE_BRANCH##*greenkeeper*}" ]]; then | ||
exit 0 | ||
fi | ||
|
||
# the name of the image that represents the "branch", that is an image that will be updated over time with the git branch | ||
# the production branch is changed to "latest", otherwise the git branch becomes the name of the version | ||
if [[ "${CIRCLE_BRANCH}" == "production" ]]; then | ||
DOCKER_BRANCH_IMAGE_VERSION="latest" | ||
else | ||
DOCKER_BRANCH_IMAGE_VERSION="${CIRCLE_BRANCH}" | ||
fi | ||
DOCKER_BRANCH_IMAGE_NAME="${DOCKER_PROJECT}:${DOCKER_BRANCH_IMAGE_VERSION}" | ||
|
||
# the name of the image that represents the "tag", that is an image that is named with the date and git commit and will never be changed | ||
DOCKER_TAG_IMAGE_VERSION="${CIRCLE_BRANCH}-${DATE}-${CIRCLE_SHA1}" | ||
DOCKER_TAG_IMAGE_NAME="${DOCKER_PROJECT}:${DOCKER_TAG_IMAGE_VERSION}" | ||
|
||
# build image and login to docker hub | ||
docker build -t $DOCKER_PROJECT . | ||
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" | ||
|
||
# copy the image to each of the two tags, and push | ||
docker tag $DOCKER_PROJECT $DOCKER_BRANCH_IMAGE_NAME | ||
docker tag $DOCKER_PROJECT $DOCKER_TAG_IMAGE_NAME | ||
docker push $DOCKER_BRANCH_IMAGE_NAME | ||
docker push $DOCKER_TAG_IMAGE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# base image | ||
FROM pelias/baseimage | ||
|
||
# libpostal apt dependencies | ||
# note: this is done in one command in order to keep down the size of intermediate containers | ||
RUN apt-get update && \ | ||
apt-get install -y autoconf automake libtool pkg-config python && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# install libpostal | ||
RUN git clone https://github.com/openvenues/libpostal /code/libpostal | ||
WORKDIR /code/libpostal | ||
RUN ./bootstrap.sh && \ | ||
./configure --datadir=/usr/share/libpostal && \ | ||
make && make check && make install && \ | ||
ldconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Pelias Libpostal Docker Baseimage | ||
|
||
This repository contains the Pelias Libpostal Docker Baseimage. This image is identical to https://github.com/pelias/baseimage but with the additional installation of [libpostal](https://github.com/openvenues/libpostal). | ||
|
||
If your container doesn't require `libpostal` then you can save RAM and disk by using the regular Pelias `baseimage` linked above instead. |