Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/add arm64 support #613

Merged
merged 4 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ on:
jobs:
docker:
# Don't change this name - it is used by the merge protection rules
name: Build and test docker image
name: Build ${{ matrix.platform }} docker image
strategy:
fail-fast: true
matrix:
include:
- platform: linux/amd64
file: Dockerfile
- platform: linux/arm64
file: arm64.Dockerfile
runs-on: ubuntu-latest
steps:

Expand All @@ -28,26 +36,29 @@ jobs:

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
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
uses: docker/setup-buildx-action@v2.5.0
with:
install: true
platforms: ${{ matrix.platform }}

- name: Build the Docker image
id: docker_build
uses: docker/build-push-action@v4
with:
file: ${{ matrix.file }}
push: false
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
platforms: ${{ matrix.platform }}

- name: Start postgres
# arm64 cannot be tested just yet
if: matrix.platform == 'linux/amd64'
uses: nyurik/action-setup-postgis@v1
id: pg
with:
Expand All @@ -57,12 +68,16 @@ jobs:
rights: --superuser

- name: Init database
# arm64 cannot be tested just yet
if: matrix.platform == 'linux/amd64'
shell: bash
run: tests/fixtures/initdb.sh
env:
DATABASE_URL: ${{ steps.pg.outputs.connection-uri }}

- name: Test Docker image
# arm64 cannot be tested just yet
if: matrix.platform == 'linux/amd64'
run: |
TAG=$(echo '${{ steps.docker_meta.outputs.json }}' | jq -r '.tags[0]')
export MARTIN_BUILD=-
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM rust:alpine as builder

RUN apk update
RUN apk add --no-cache openssl-dev musl-dev perl build-base

WORKDIR /usr/src/martin
ADD . .

RUN apk update \
&& apk add --no-cache openssl-dev musl-dev perl build-base

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


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"]