Add build pipeline and deployment files

This commit is contained in:
2019-02-11 12:52:32 +01:00
parent eebefb0ef4
commit 819feb6401
4 changed files with 87 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
vendor
.gitignore
.git
Dockerfile
+27
View File
@@ -0,0 +1,27 @@
stages:
- build
- deploy
variables:
DOCKER_HOST: tcp://docker:2375/
image: registry.gitlab.com/sparetimecoders/build-tools
build:
stage: build
services:
- docker:dind
script:
- build
- push
deploy:
stage: deploy
when: on_success
script:
- echo Deploying
- deploy prod
environment:
name: prod
only:
- master
+11
View File
@@ -0,0 +1,11 @@
FROM gunosy/ci-go-glide as builder
WORKDIR /go/src/gitlab.com/unboundsoftware/geo-service
COPY glide.* ./
RUN glide install
COPY * ./
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o geo-service .
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/gitlab.com/unboundsoftware/geo-service/geo-service /
CMD ["/geo-service"]
+45
View File
@@ -0,0 +1,45 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: geo-service
name: geo-service
annotations:
kubernetes.io/change-cause: "${TIMESTAMP} Deployed commit id: ${COMMIT}"
spec:
replicas: 1
selector:
matchLabels:
app: geo-service
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: geo-service
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- geo-service
topologyKey: kubernetes.io/hostname
containers:
- name: geo-service
resources:
limits:
memory: "100Mi"
requests:
memory: "100Mi"
imagePullPolicy: Always
image: registry.gitlab.com/unboundsoftware/dancefinder/geo-service:${COMMIT}
restartPolicy: Always