Docker container building.
This commit is contained in:
parent
095aff540e
commit
6efe28f598
@ -6,9 +6,12 @@ variables:
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TCP_PORT: 2375
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
REGISTRY_IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
|
||||
REGISTRY_IMAGE_TAGGED: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
|
||||
stages:
|
||||
- test
|
||||
- release
|
||||
|
||||
lint:
|
||||
stage: test
|
||||
@ -17,3 +20,27 @@ lint:
|
||||
image: registry.gitlab.pztrn.name/containers/mirror/golangci/golangci-lint:v1.33.0
|
||||
script:
|
||||
- golangci-lint run
|
||||
|
||||
build_master_image:
|
||||
stage: release
|
||||
only:
|
||||
- master
|
||||
tags:
|
||||
- docker
|
||||
image: $DOCKER_IMAGE
|
||||
script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
- docker build --pull -t $REGISTRY_IMAGE_LATEST --build-arg CI_COMMIT_TAG=${CI_COMMIT_TAG} --build-arg CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME} --build-arg CI_COMMIT_SHA=${CI_COMMIT_SHA} --build-arg CI_PROJECT_NAME=${CI_PROJECT_NAME} .
|
||||
- docker push $REGISTRY_IMAGE_LATEST
|
||||
|
||||
build_tag_image:
|
||||
stage: release
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
image: $DOCKER_IMAGE
|
||||
script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
- docker build -t $REGISTRY_IMAGE_TAGGED --build-arg CI_COMMIT_TAG=${CI_COMMIT_TAG} --build-arg CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME} --build-arg CI_COMMIT_SHA=${CI_COMMIT_SHA} --build-arg CI_PROJECT_NAME=${CI_PROJECT_NAME} .
|
||||
- docker push $REGISTRY_IMAGE_TAGGED
|
||||
|
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM registry.gitlab.pztrn.name/containers/mirror/golang:1.15.5-alpine AS build
|
||||
|
||||
WORKDIR /go/src/gitlab.pztrn.name/pztrn/metricator
|
||||
COPY . .
|
||||
|
||||
ARG CI_PROJECT_NAME
|
||||
ARG CI_COMMIT_SHA
|
||||
ARG CI_COMMIT_REF_NAME
|
||||
ARG CI_COMMIT_TAG
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
RUN make metricatord-build
|
||||
|
||||
FROM registry.gitlab.pztrn.name/containers/mirror/golang:1.15.5-alpine
|
||||
LABEL maintainer="Stanislav N. <pztrn@pztrn.name>"
|
||||
|
||||
COPY --from=build /go/src/gitlab.pztrn.name/pztrn/metricator/.bin/metricatord /usr/local/bin/metricatord
|
||||
|
||||
RUN apk add tzdata
|
||||
|
||||
ENTRYPOINT [ "/usr/local/bin/metricatord", "-config", "/config.yaml" ]
|
Loading…
Reference in New Issue
Block a user