From 06ed04fbbbb446cadf65aad309d6a7ccda117733 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Sat, 2 Jul 2022 00:34:46 +0200 Subject: [PATCH] feat: Added gitlab CI config and Dockerfile Signed-off-by: Louis Vallat --- .gitlab-ci.yml | 31 +++++++++++++++++++++++++++++++ Dockerfile | 15 +++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..2a96af4 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,31 @@ +image: docker:latest +services: + - docker:dind + +stages: + - release + - deploy + +variables: + DOCKER_HOST: tcp://docker:2376 + DOCKER_TLS_CERTDIR: "/certs" + CONTAINER_BRANCH_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest + +release: + stage: release + script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - docker build . -t $CONTAINER_BRANCH_IMAGE + - docker push $CONTAINER_BRANCH_IMAGE + +release-master: + stage: release + script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - docker build . -t $CONTAINER_RELEASE_IMAGE + - docker push $CONTAINER_RELEASE_IMAGE + only: + - master + + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2ddfa03 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM rust:latest AS builder + +WORKDIR /root + +COPY . . + +RUN cargo build --release + +FROM debian:stable-slim + +RUN apt update && apt install -y ca-certificates openssl && apt clean + +COPY --from=builder /root/target/release/lb-influx-connector /root/lb-influx-connector + +CMD ["/root/lb-influx-connector"]