From 20a92be2a9eb412e91e3077602423bea9dffe9fb Mon Sep 17 00:00:00 2001 From: Kai Jan Kriegel Date: Tue, 6 Oct 2020 14:21:59 +0200 Subject: [PATCH 1/3] added dockerfile and docker-compose.yaml --- Dockerfile | 21 +++++++++++++++++++++ docker-compose.yaml | 12 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..43caff1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# Setup build image for multistage build +FROM rust:latest as builder +# install build deps +RUN apt-get update && apt-get upgrade -y +RUN apt-get install -yqq --no-install-recommends capnproto build-essential cmake clang libclang-dev libgsasl7-dev + +WORKDIR /usr/src/bffh +COPY . . +RUN cargo install --path . + + +# Setup deployable image +FROM debian:buster-slim +# Install runtime deps +RUN apt-get update && apt-get upgrade -yqq +RUN apt-get install -yqq libgsasl7 && rm -rf /var/lib/apt/lists/* +COPY --from=builder /usr/local/cargo/bin/diflouroborane /usr/local/bin/diflouroborane +# RUN diflouroborane --print-default > /etc/diflouroborane.toml +VOLUME /etc/diflouroborane.toml +EXPOSE 59661 +ENTRYPOINT ["diflouroborane"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..004ea66 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,12 @@ +version: "3.8" +services: + bffh: + build: . + ports: + - "59661:59661" + volumes: + - "$PWD/config.toml:/etc/diflouroborane.toml" + links: + - mqtt + mqtt: + image: eclipse-mosquitto \ No newline at end of file From f222b76e59f08993478280c7ba9e65d4fbbe4bb4 Mon Sep 17 00:00:00 2001 From: Kai Kriegel Date: Tue, 6 Oct 2020 12:43:40 +0000 Subject: [PATCH 2/3] Update .gitlab-ci.yml --- .gitlab-ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index deaa054..d940ae2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,6 +64,41 @@ test:cargo: - linux - docker +build:docker-master: + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest + only: + - master + +build:docker-releases: + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG + only: + - tags + +build:docker-development: + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:dev-$CI_COMMIT_TAG + only: + - development # cache dependencies and build environment to speed up setup cache: From aa34da3c88375aab6d623044d5f27f1f93d8ac71 Mon Sep 17 00:00:00 2001 From: Kai Kriegel Date: Tue, 6 Oct 2020 13:04:53 +0000 Subject: [PATCH 3/3] added comment on how to get a default config file --- docker-compose.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 004ea66..d8cd4f0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,8 +5,9 @@ services: ports: - "59661:59661" volumes: + # generate a sample config.toml by running "docker run diflouroborane --print-default". You may have to delete the ipv6 listen section. - "$PWD/config.toml:/etc/diflouroborane.toml" links: - mqtt mqtt: - image: eclipse-mosquitto \ No newline at end of file + image: eclipse-mosquitto