New Dockerfile and Travis Config

This commit is contained in:
Richard Patel 2019-02-22 00:16:53 +01:00
parent b18b70f798
commit f845e12a29
No known key found for this signature in database
GPG Key ID: C268B2BBDA2ABECB
2 changed files with 30 additions and 0 deletions

View File

@ -1,5 +1,26 @@
# https://ops.tips/blog/travis-ci-push-docker-image/
language: go
go:
- "1.11.x"
- master
sudo: required
services:
- docker
before_install:
- sudo apt update -y
- sudo apt install golang-go -y
script:
- go test .
- docker build -t terorie/od-database-crawler
after_success:
- if [[ "$TRAVIS_BRANCH" == "stable" ]]; then
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD ;
docker push terorie/od-database-crawler ;
fi

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM golang:1.11.5 AS builder
ADD . /src
RUN cd /src
&& go build -o binary
FROM alpine
WORKDIR /app
COPY --from=builder /src/binary /app/
ENTRYPOINT ./binary