From c9e044b3ad60d25e9641d22d84571a7db83a26ac Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 15 Aug 2022 23:56:15 +0200 Subject: [PATCH] fix: add debian-based docker image for arm 32 builds --- .drone.yml | 35 ++++++++++++++++++++++++- Dockerfile.arm32 | 48 +++++++++++++++++++++++++++++++++++ docker-manifest-unstable.tmpl | 5 ++++ docker-manifest.tmpl | 5 ++++ 4 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.arm32 diff --git a/.drone.yml b/.drone.yml index 884ca88699..57f19194c1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -664,6 +664,39 @@ steps: commands: - git fetch --tags + - name: docker-arm-unstable + image: plugins/docker:linux-arm + pull: true + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: vikunja/api + tags: unstable-linux-arm + dockerfile: Dockerfile.arm32 + depends_on: [ fetch-tags ] + when: + ref: + - refs/heads/main + + - name: docker-arm + image: plugins/docker:linux-arm + pull: true + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + repo: vikunja/api + auto_tag: true + auto_tag_suffix: linux-arm + dockerfile: Dockerfile.arm32 + depends_on: [ fetch-tags ] + when: + ref: + - "refs/tags/**" + - name: docker-arm64-unstable image: plugins/docker:linux-arm64 pull: true @@ -845,6 +878,6 @@ steps: - failure --- kind: signature -hmac: 59e619a19be0bda1935ff2b49ac7b56a0511ac8ecfd2a05a6460bf5840876ba5 +hmac: e72b631f902689777e3263ae9527e5aa47738b9021538f7cb5034f95ac265f07 ... diff --git a/Dockerfile.arm32 b/Dockerfile.arm32 new file mode 100644 index 0000000000..ce51c958f2 --- /dev/null +++ b/Dockerfile.arm32 @@ -0,0 +1,48 @@ + +############## +# Build stage +FROM golang:1.18-buster AS build-env + +RUN go install github.com/magefile/mage@latest && \ + mv /go/bin/mage /usr/local/go/bin + +ARG VIKUNJA_VERSION + +# Setup repo +COPY . /go/src/code.vikunja.io/api +WORKDIR /go/src/code.vikunja.io/api + +# Checkout version if set +RUN if [ -n "${VIKUNJA_VERSION}" ]; then git checkout "${VIKUNJA_VERSION}"; fi \ + && mage build:clean build + +################### +# The actual image +# Note: I wanted to use the scratch image here, but unfortunatly the go-sqlite bindings require cgo and +# because of this, the container would not start when I compiled the image without cgo. +# We're using debian as a base image here because the latest alpine image does not work with arm. +FROM debian:buster-slim +LABEL maintainer="maintainers@vikunja.io" + +WORKDIR /app/vikunja/ +COPY --from=build-env /go/src/code.vikunja.io/api/vikunja . +ENV VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/ + +# Dynamic permission changing stuff +ENV PUID 1000 +ENV PGID 1000 +RUN addgroup --gid ${PGID} vikunja && \ + chown ${PUID} -R /app/vikunja && \ + useradd --shell /bin/sh --gid vikunja --uid ${PUID} --home-dir /app/vikunja vikunja +COPY run.sh /run.sh + +# Fix time zone settings not working +RUN apt-get update && apt-get install -y tzdata && apt-get clean + +# Files permissions +RUN mkdir /app/vikunja/files && \ + chown -R vikunja /app/vikunja/files +VOLUME /app/vikunja/files + +CMD ["/run.sh"] +EXPOSE 3456 diff --git a/docker-manifest-unstable.tmpl b/docker-manifest-unstable.tmpl index 32a798617d..d06b475367 100644 --- a/docker-manifest-unstable.tmpl +++ b/docker-manifest-unstable.tmpl @@ -10,3 +10,8 @@ manifests: platform: architecture: arm64 os: linux + - + image: vikunja/api:unstable-linux-arm + platform: + architecture: arm + os: linux diff --git a/docker-manifest.tmpl b/docker-manifest.tmpl index d0ee756822..4561c5f03e 100644 --- a/docker-manifest.tmpl +++ b/docker-manifest.tmpl @@ -16,3 +16,8 @@ manifests: platform: architecture: arm64 os: linux + - + image: vikunja/api:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm + platform: + architecture: arm + os: linux