From 028eec149c64d108a68c41f5741f7844e89d9457 Mon Sep 17 00:00:00 2001 From: Alexander Wellbrock <a.wellbrock@mailbox.org> Date: Thu, 23 Apr 2020 12:18:17 +0200 Subject: [PATCH] Add Dockerfile --- .gitlab-ci.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 12 ++++++++++++ README.md | 2 +- 3 files changed, 42 insertions(+), 1 deletion(-) 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..d41bc95 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ +image: registry.gitlab.com/othermo/fedora-build:latest + +before_script: + - git config --global user.email "info@othermo.de" + - git config --global user.name "Othermo CI" + - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + +build-master: + script: + - podman pull $CI_REGISTRY_IMAGE:latest || true + - podman build --layers=false --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG --tag $CI_REGISTRY_IMAGE:latest . + - podman push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + - podman push $CI_REGISTRY_IMAGE:latest + only: + # this build script would conflict with other branches + - master + tags: + - aarch64 + +build: + script: + - podman pull $CI_REGISTRY_IMAGE:latest || true + - podman build --layers=false --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG . + - podman push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + except: + # this build script would conflict with other branches + - master + tags: + - aarch64 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b604668 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM docker.io/library/fedora:31 + +COPY pi-mqtt-gpio/ /var/srv/pi-mqtt-gpio/ + +WORKDIR /var/srv/pi-mqtt-gpio + +RUN dnf install -y libgpiod libgpiod-devel libgpiod-c++ python3-libgpiod python3-pip && \ + pip install -r /var/srv/pi-mqtt-gpio/requirements.txt && \ + dnf remove -y python3-pip && \ + dnf clean all + +CMD [ "/usr/bin/python3", "-m", "pi_mqtt_gpio.server", "config.yml" ] \ No newline at end of file diff --git a/README.md b/README.md index 583da46..ea684a6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # mqtt-gpio-container -Containerized version of the mqtt-gpio project. \ No newline at end of file +Containerized version of the mqtt-gpio project. -- GitLab