Skip to content

Commit

Permalink
feat: add CI build for ARM64 Docker image
Browse files Browse the repository at this point in the history
Signed-off-by: Ismayil Mirzali <ismayilmirzeli@gmail.com>
  • Loading branch information
Volatus committed Mar 26, 2023
1 parent 8ef8953 commit e4b7251
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 2 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/docker-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Docker ARM64

on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
workflow_dispatch:

jobs:
docker:
# Don't change this name - it is used by the merge protection rules
name: Build and test docker image
runs-on: ubuntu-latest
steps:

- name: Checkout sources
uses: actions/checkout@v3

# https://github.com/docker/metadata-action
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/maplibre/martin

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0

# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0
with:
install: true
platforms: linux/arm64

- name: Build the Docker image
id: docker_build
uses: docker/build-push-action@v4
with:
file: arm64.Dockerfile
push: false
load: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
platforms: linux/arm64

- name: Login to GitHub Docker registry
uses: docker/login-action@v2
if: ${{ github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push the Docker image
if: ${{ github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' }}
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
2 changes: 0 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ jobs:
load: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
# TODO: enable for multi-platform build
# platforms: linux/amd64,linux/arm64

- name: Start postgres
uses: nyurik/action-setup-postgis@v1
Expand Down
24 changes: 24 additions & 0 deletions arm64.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM rust:1.68-bullseye as builder

WORKDIR /usr/src/martin

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libssl-dev \
perl \
&& rm -rf /var/lib/apt/lists/*

COPY . .
RUN CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo build --release --features=vendored-openssl


FROM debian:bullseye-slim

LABEL org.opencontainers.image.description="Blazing fast and lightweight tile server with PostGIS, MBTiles, and PMTiles support"

COPY --from=builder \
/usr/src/martin/target/release/martin \
/usr/local/bin/

EXPOSE 3000
ENTRYPOINT ["/usr/local/bin/martin"]

0 comments on commit e4b7251

Please sign in to comment.