From cc810269e210f16b402876bc3d9860c4b4bbcb5a Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Tue, 29 Aug 2023 11:59:35 +0200 Subject: [PATCH] Add Dockerfile + CI/CD --- .drone-manifest.yml | 22 ++++++++++++++ .drone.yml | 73 +++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 19 ++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 .drone-manifest.yml create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone-manifest.yml b/.drone-manifest.yml new file mode 100644 index 0000000..b986849 --- /dev/null +++ b/.drone-manifest.yml @@ -0,0 +1,22 @@ +image: registry.nemunai.re/epaper-status:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - image: registry.nemunai.re/epaper-status:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + - image: registry.nemunai.re/epaper-status:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64 + platform: + architecture: arm64 + os: linux + variant: v8 + - image: registry.nemunai.re/epaper-status:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm + platform: + architecture: arm + os: linux + variant: v7 diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..5f96881 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,73 @@ +--- +kind: pipeline +type: docker +name: build-amd64 + +platform: + os: linux + arch: amd64 + +steps: + - name: docker build and publish + image: plugins/docker + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + registry: registry.nemunai.re + repo: registry.nemunai.re/epaper-status + auto_tag: true + auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + when: + branch: + - master + +--- +kind: pipeline +type: docker +name: build-arm64 + +platform: + os: linux + arch: arm64 + +steps: + - name: docker build and publish + image: plugins/docker + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + registry: registry.nemunai.re + repo: registry.nemunai.re/epaper-status + auto_tag: true + auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} + when: + branch: + - master + +--- +kind: pipeline +name: docker-manifest +steps: + - name: publish manifest + image: plugins/manifest + settings: + auto_tag: true + ignore_missing: true + spec: .drone-manifest.yml + username: + from_secret: docker_username + password: + from_secret: docker_password + +trigger: + event: + - push + - tag + +depends_on: +- build-amd64 +- build-arm64 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1ab233b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM python:3-alpine + +ENTRYPOINT ["python", "/srv/e-paper/main.py"] + +WORKDIR /srv/e-paper +VOLUME /data + +RUN apk add --no-cache cairo py3-cairosvg && pip install --upgrade icalendar "Pillow<10" pygal + +ADD https://github.com/adobe-fonts/source-sans/raw/release/OTF/SourceSans3-Bold.otf /usr/share/fonts/source-sans/SourceSans3-Bold.otf +ADD https://github.com/adobe-fonts/source-sans/raw/release/OTF/SourceSans3-It.otf /usr/share/fonts/source-sans/SourceSans3-It.otf +ADD https://github.com/adobe-fonts/source-sans/raw/release/OTF/SourceSans3-Regular.otf /usr/share/fonts/source-sans/SourceSans3-Regular.otf + +COPY modules modules +COPY fonts fonts +COPY icons icons +COPY main.py . + +WORKDIR /data