Build featurebase docker image in CI.

Add to registry.
This commit is contained in:
Samir Patel 2021-10-20 12:21:05 -05:00
parent a83b7f64a0
commit 44148ed79d
2 changed files with 23 additions and 54 deletions

View file

@ -4,7 +4,7 @@ include:
- template: Security/Dependency-Scanning.gitlab-ci.yml
variables:
GO_VERSION: 1.16.3
GOVERSION: "1.16.3"
stages:
- test
@ -126,18 +126,20 @@ build for darwin arm64:
paths:
- featurebase_darwin_arm64
# Build a Docker image with CI/CD and push to the GitLab registry.
# Build a FB Docker image with CI/CD and push to the GitLab registry.
build container fb:
image: docker:latest
image: docker:stable
stage: build
services:
- docker:dind
script:
- |
docker build
--build-arg GO_VERSION=$(GO_VERSION)
--tag featurebase:$(VERSION) .
- docker push "$CI_REGISTRY_IMAGE${tag}"
- @echo Created docker image: featurebase:$(VERSION)
needs:
- "build for linux amd64"
tags:
- shell
before_script:
- echo "${DOCKER_DEPLOY_TOKEN}" | docker login -u ${DOCKER_DEPLOY_USER} --password-stdin ${CI_REGISTRY}
script:
- tag=${CI_REGISTRY_IMAGE}/server:${CI_COMMIT_REF_SLUG}
- docker build --build-arg GO_VERSION=$GOVERSION -t $tag -f .gitlab/Dockerfile .
- docker push $tag
- echo Created docker featurebase image with tag "$tag"

View file

@ -1,50 +1,17 @@
ARG GO_VERSION=latest
#######################
### Lattice builder ###
#######################
FROM moleculacorp/nodejs:latest as lattice-builder
WORKDIR /lattice
COPY lattice/package.json ./
COPY lattice/yarn.lock ./
RUN yarn install
COPY lattice ./
RUN yarn build
######################
### Pilosa builder ###
######################
FROM golang:${GO_VERSION} as pilosa-builder
ARG MAKE_FLAGS
WORKDIR /pilosa
RUN go get github.com/rakyll/statik
COPY . ./
COPY --from=lattice-builder /lattice/build /lattice
RUN /go/bin/statik -src=/lattice -dest=/pilosa
RUN make build FLAGS="-o build/featurebase" ${MAKE_FLAGS}
#####################
### Pilosa runner ###
#####################
FROM alpine:3.13.2 as runner
FROM alpine:3.14.2
LABEL maintainer "dev@molecula.com"
LABEL org.opencontainers.image.authors="dev@molecula.com"
WORKDIR /featurebase
RUN apk add --no-cache curl jq
COPY --from=pilosa-builder /pilosa/build/featurebase /
COPY LICENSE /LICENSE
COPY NOTICE /NOTICE
COPY LICENSE .
COPY NOTICE .
COPY featurebase_linux_amd64 .
RUN chmod ugo+x .
EXPOSE 10101
VOLUME /data
@ -53,4 +20,4 @@ ENV PILOSA_BIND 0.0.0.0:10101
ENV PILOSA_BIND_GRPC 0.0.0.0:20101
ENTRYPOINT ["/featurebase"]
CMD ["server"]
CMD ["server"]