Merge branch 'feature/dockerfile' into 'development'

Feature/dockerfile

See merge request fabinfra/fabaccess/bffh!4
This commit is contained in:
Kai Kriegel 2020-10-06 13:17:16 +00:00
commit 59f090cd91
3 changed files with 69 additions and 0 deletions

View File

@ -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:

21
Dockerfile Normal file
View File

@ -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"]

13
docker-compose.yaml Normal file
View File

@ -0,0 +1,13 @@
version: "3.8"
services:
bffh:
build: .
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