Skip to content

Commit

Permalink
feat: support linux/amd64, and linux/arm64 platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
rlespinasse committed Jul 24, 2023
1 parent 05014d7 commit b24194b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/docker-drawio-desktop-headless.yaml
Expand Up @@ -42,10 +42,31 @@ jobs:
!tests/data/*/*.drawio
if: ${{ always() }}

build-multiarch:
runs-on: ubuntu-latest
concurrency:
group: build-multiarch-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: rlespinasse/github-slug-action@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64,arm'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build docker image
run: make build-multiarch
shell: bash
env:
DOCKER_IMAGE: ${{ github.repository }}:${{ env.GITHUB_REF_SLUG }}

release:
runs-on: ubuntu-latest
needs:
- build
- build-multiarch
concurrency:
group: release-${{ github.ref }}-${{ github.event_name }}
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish.yaml
Expand Up @@ -8,10 +8,13 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: rlespinasse/github-slug-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: rlespinasse/drawio-desktop-headless
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: 'latest,${{ env.GITHUB_REF_SLUG }}'
platforms: linux/amd64,linux/arm64
8 changes: 5 additions & 3 deletions Dockerfile
@@ -1,19 +1,21 @@
FROM debian:bullseye
ARG TARGETARCH

WORKDIR "/opt/drawio-desktop"

ENV DRAWIO_VERSION "21.6.5"
RUN set -e; \
echo "selected arch: ${TARGETARCH}"; \
apt-get update && apt-get install -y \
xvfb \
wget \
libgbm1 \
libasound2 \
# Fonts
fonts-liberation fonts-arphic-ukai fonts-arphic-uming fonts-noto fonts-noto-cjk fonts-ipafont-mincho fonts-ipafont-gothic fonts-unfonts-core \
; wget -q https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-amd64-${DRAWIO_VERSION}.deb \
&& apt-get install -y /opt/drawio-desktop/drawio-amd64-${DRAWIO_VERSION}.deb \
&& rm -rf /opt/drawio-desktop/drawio-amd64-${DRAWIO_VERSION}.deb; \
; wget -q https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-${TARGETARCH}-${DRAWIO_VERSION}.deb \
&& apt-get install -y /opt/drawio-desktop/drawio-${TARGETARCH}-${DRAWIO_VERSION}.deb \
&& rm -rf /opt/drawio-desktop/drawio-${TARGETARCH}-${DRAWIO_VERSION}.deb; \
apt-get remove -y wget; \
rm -rf /var/lib/apt/lists/*;

Expand Down
16 changes: 13 additions & 3 deletions Makefile
@@ -1,11 +1,21 @@
.PHONY: build build-no-cache cleanup run test test-ci-setup test-ci
.PHONY: build build-no-cache build-multiarch cleanup run test test-ci-setup test-ci

# amd64 by default, arm64 for arm machine like macbook m1
ifneq ($(filter arm%,$(shell uname -p)),)
ARCHFLAG := "arm64"
else
ARCHFLAG := "amd64"
endif

DOCKER_IMAGE?=rlespinasse/drawio-desktop-headless:local
build:
@docker build -t ${DOCKER_IMAGE} .
@docker build --build-arg="TARGETARCH=$(ARCHFLAG)" -t ${DOCKER_IMAGE} .

build-no-cache:
@docker build --no-cache --progress plain -t ${DOCKER_IMAGE} .
@docker build --build-arg="TARGETARCH=$(ARCHFLAG)" --no-cache --progress plain -t ${DOCKER_IMAGE} .

build-multiarch:
@docker buildx build --platform linux/amd64,linux/arm64 -t ${DOCKER_IMAGE} .

cleanup:
@rm -rf tests/output
Expand Down

0 comments on commit b24194b

Please sign in to comment.