gitlab fixes

This commit is contained in:
Mads Schou-Andreasen 2020-05-20 00:06:08 +02:00
parent bff11ad0ae
commit 8ae46dfda3
3 changed files with 78 additions and 3 deletions

2
.gitignore vendored
View File

@ -9,3 +9,5 @@ packages/
# Ignore IDE folders
.idea/
.vscode/
vendor/*
/vendor/

61
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,61 @@
variables:
GITLAB_IMAGE: registry.gitlab.com/oceanboltpub/tile38
stages:
- build
- push
.build_images: &build_images
before_script:
- echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token registry.gitlab.com --password-stdin
- docker login -u _json_key --password-stdin https://eu.gcr.io < $GITLAB_DEPLOY_BOT_KEY
image: docker:19.03.0
services:
- docker:19.03.0-dind
variables:
#DOCKER_HOST: tcp://localhost:2375
DOCKER_TLS_DIR: "/certs"
DOCKER_DRIVER: overlay2
stage: build
only:
- master
- development
- merge_requests
tags:
- docker
script:
- docker pull $GITLAB_IMAGE:$EDITION || true
- >
docker build
--build-arg VCS_REF=$CI_COMMIT_SHA
--build-arg VCS_URL=$CI_PROJECT_URL
--tag $GITLAB_IMAGE:$CI_COMMIT_SHA
.
- docker push $GITLAB_IMAGE
.push_master: &push_master
before_script:
- echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token registry.gitlab.com --password-stdin
- docker login -u _json_key --password-stdin https://eu.gcr.io < $GITLAB_DEPLOY_BOT_KEY
image: docker:19.03.0
services:
- docker:19.03.0-dind
stage: push
only:
- master
variables:
# Again, we do not need the source code here. Just playing with Docker.
GIT_STRATEGY: none
#DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
# Create the certificates inside this directory for both the server
# and client. The certificates used by the client will be created in
# /certs/client so we only need to share this directory with the
# volume mount in `config.toml`.
DOCKER_TLS_CERTDIR: "/certs"
script:
- docker pull $GITLAB_IMAGE:$CI_COMMIT_SHA
- docker tag $GITLAB_IMAGE:$CI_COMMIT_SHA $GITLAB_IMAGE:latest
- docker push $GITLAB_IMAGE:latest
# Here, the goal is to tag the "master" branch as "latest"

View File

@ -1,9 +1,21 @@
FROM golang:1.13 as builder
# Copy local code to the container image.
WORKDIR /tile38
COPY . .
COPY ./cmd/tile38-server/main.go .
# Build the command inside the container.
# (You may fetch or manage dependencies here,
# either manually or with a tool like "godep".)
RUN CGO_ENABLED=0 GOOS=linux go build -v -o tile38-server
FROM alpine:3.8
RUN apk add --no-cache ca-certificates
ADD tile38-server /usr/local/bin
ADD tile38-cli /usr/local/bin
ADD tile38-benchmark /usr/local/bin
COPY --from=builder /tile38/tile38-server /usr/local/bin/tile38-server
#ADD tile38-cli /usr/local/bin
#ADD tile38-benchmark /usr/local/bin
RUN addgroup -S tile38 && \
adduser -S -G tile38 tile38 && \