tests if docker gets built in gitlab

This commit is contained in:
Samir Patel 2021-10-20 11:20:20 -05:00
parent 3605449b53
commit a83b7f64a0
2 changed files with 76 additions and 1 deletions

View file

@ -3,6 +3,9 @@ include:
- template: Security/License-Scanning.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
variables:
GO_VERSION: 1.16.3
stages:
- test
- build
@ -121,4 +124,20 @@ build for darwin arm64:
- go build -o featurebase_darwin_arm64 ./cmd/featurebase
artifacts:
paths:
- featurebase_darwin_arm64
- featurebase_darwin_arm64
# Build a Docker image with CI/CD and push to the GitLab registry.
build container fb:
image: docker:latest
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)

56
.gitlab/Dockerfile Normal file
View file

@ -0,0 +1,56 @@
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
LABEL maintainer "dev@molecula.com"
RUN apk add --no-cache curl jq
COPY --from=pilosa-builder /pilosa/build/featurebase /
COPY LICENSE /LICENSE
COPY NOTICE /NOTICE
EXPOSE 10101
VOLUME /data
ENV PILOSA_DATA_DIR /data
ENV PILOSA_BIND 0.0.0.0:10101
ENV PILOSA_BIND_GRPC 0.0.0.0:20101
ENTRYPOINT ["/featurebase"]
CMD ["server"]