mirror of https://github.com/tidwall/tile38.git
CI improvements (#1)
This PR contains: * Automatic version detection by using git tags * Fix for the Makefile (double package target) * Enable Travis CI to build the Docker images and push to Docker Hub
This commit is contained in:
parent
af95127654
commit
75e0abfe51
16
.travis.yml
16
.travis.yml
|
@ -1,2 +1,16 @@
|
||||||
language: go
|
language: go
|
||||||
script: make test
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
script:
|
||||||
|
- make test
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
|
||||||
|
- export REPO=$DOCKER_USER/tile38
|
||||||
|
- export COMMIT_SHORT=$(git rev-parse --short HEAD)
|
||||||
|
- docker build -f docker/Dockerfile -t $REPO:$COMMIT_SHORT .
|
||||||
|
- export TAG=`if [ ! -z "$TRAVIS_TAG" ]; then echo $TRAVIS_TAG; elif [ "$TRAVIS_BRANCH" == "master" ]; then echo "edge"; else echo ""; fi`
|
||||||
|
- if [[ ! -z "$TAG" && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then docker tag $REPO:$COMMIT_SHORT $REPO:$TAG && docker push $REPO:$TAG && echo "Pushed $REPO:$TAG"; else echo "Not pushing, either not on master or on a PR"; fi
|
||||||
|
- if [[ ! -z "$TRAVIS_TAG" ]]; then docker tag $REPO:$COMMIT_SHORT $REPO:latest && docker push $REPO:latest && echo "Pushed $REPO:latest"; else echo "Not pushing, no tag"; fi
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -17,6 +17,5 @@ uninstall:
|
||||||
rm -f /usr/local/bin/tile38-server
|
rm -f /usr/local/bin/tile38-server
|
||||||
rm -f /usr/local/bin/tile38-cli
|
rm -f /usr/local/bin/tile38-cli
|
||||||
rm -f /usr/local/bin/tile38-benchmark
|
rm -f /usr/local/bin/tile38-benchmark
|
||||||
package:
|
|
||||||
package:
|
package:
|
||||||
@./build.sh package
|
@./build.sh package
|
||||||
|
|
3
build.sh
3
build.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
VERSION="1.12.0"
|
VERSION=$(git describe --tags | sed 's/-/\n/g' | head -n 1)
|
||||||
PROTECTED_MODE="no"
|
PROTECTED_MODE="no"
|
||||||
|
|
||||||
# Hardcode some values to the core package
|
# Hardcode some values to the core package
|
||||||
|
@ -120,7 +120,6 @@ function rmtemp {
|
||||||
}
|
}
|
||||||
trap rmtemp EXIT
|
trap rmtemp EXIT
|
||||||
|
|
||||||
|
|
||||||
if [ "$NOLINK" != "1" ]; then
|
if [ "$NOLINK" != "1" ]; then
|
||||||
# symlink root to isolated directory
|
# symlink root to isolated directory
|
||||||
mkdir -p "$TMP/go/src/github.com/tidwall"
|
mkdir -p "$TMP/go/src/github.com/tidwall"
|
||||||
|
|
|
@ -1,25 +1,13 @@
|
||||||
FROM alpine:3.4
|
FROM alpine:3.4
|
||||||
|
|
||||||
ENV TILE38_VERSION 1.12.0
|
ADD ./tile38-server /usr/local/bin
|
||||||
ENV TILE38_DOWNLOAD_URL https://github.com/tidwall/tile38/releases/download/$TILE38_VERSION/tile38-$TILE38_VERSION-linux-amd64.tar.gz
|
ADD ./tile38-cli /usr/local/bin
|
||||||
|
|
||||||
RUN addgroup -S tile38 && adduser -S -G tile38 tile38
|
RUN addgroup -S tile38 && \
|
||||||
|
adduser -S -G tile38 tile38 && \
|
||||||
RUN apk update \
|
mkdir /data && chown tile38:tile38 /data
|
||||||
&& apk add ca-certificates \
|
|
||||||
&& update-ca-certificates \
|
|
||||||
&& apk add openssl \
|
|
||||||
&& wget -O tile38.tar.gz "$TILE38_DOWNLOAD_URL" \
|
|
||||||
&& tar -xzvf tile38.tar.gz \
|
|
||||||
&& rm -f tile38.tar.gz \
|
|
||||||
&& mv tile38-$TILE38_VERSION-linux-amd64/tile38-server /usr/local/bin \
|
|
||||||
&& mv tile38-$TILE38_VERSION-linux-amd64/tile38-cli /usr/local/bin \
|
|
||||||
&& rm -fR tile38-$TILE38_VERSION-linux-amd64
|
|
||||||
|
|
||||||
RUN mkdir /data && chown tile38:tile38 /data
|
|
||||||
|
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
WORKDIR /data
|
|
||||||
|
|
||||||
EXPOSE 9851
|
EXPOSE 9851
|
||||||
CMD ["tile38-server"]
|
CMD ["tile38-server", "-d", "/data"]
|
||||||
|
|
Loading…
Reference in New Issue