mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Build Docker image for ARM
First pass Fix? Minor Dockerfile fixes Fix yet another lint problem Fix? Fix?? Fix 2 Fix? Remove step hopefully this time Fixes to annotations Fix again? Final touch I am stupid Fix
This commit is contained in:
parent
a6d4cd7c15
commit
e3b200e6b5
2 changed files with 126 additions and 30 deletions
149
.github/workflows/docker_image.yml
vendored
149
.github/workflows/docker_image.yml
vendored
|
@ -37,11 +37,19 @@ on:
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
# github.repository as <account>/<repo>
|
# github.repository as <account>/<repo>
|
||||||
|
# sadly there is no way to lowercase the string, so in some occurences we have to do it in a dedicated step
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
@ -51,48 +59,133 @@ jobs:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
platform=${{ matrix.platform }}
|
||||||
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Setup Docker buildx
|
- name: Setup Docker buildx
|
||||||
uses: docker/setup-buildx-action@v3.0.0
|
uses: docker/setup-buildx-action@v3.10.0
|
||||||
|
|
||||||
# Login against the Docker registry except on PR
|
# Extract metadata (tags, labels, annotations) for Docker
|
||||||
# https://github.com/docker/login-action
|
|
||||||
- name: Log into registry ${{ env.REGISTRY }}
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v3.0.0
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
# Extract metadata (tags, labels) for Docker
|
|
||||||
# https://github.com/docker/metadata-action
|
# https://github.com/docker/metadata-action
|
||||||
- name: Extract Docker metadata
|
- name: Extract Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5.5.0
|
uses: docker/metadata-action@v5.7.0
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
labels: |
|
labels: |
|
||||||
org.opencontainers.image.title=Luanti
|
org.opencontainers.image.title=Luanti
|
||||||
org.opencontainers.image.vendor=Luanti
|
org.opencontainers.image.vendor=Luanti
|
||||||
|
org.opencontainers.image.description=Luanti (formerly Minetest) is an open source voxel game-creation platform with easy modding and game creation
|
||||||
org.opencontainers.image.licenses=LGPL-2.1-only
|
org.opencontainers.image.licenses=LGPL-2.1-only
|
||||||
|
annotations: |
|
||||||
|
org.opencontainers.image.title=Luanti
|
||||||
|
org.opencontainers.image.vendor=Luanti
|
||||||
|
org.opencontainers.image.description=Luanti (formerly Minetest) is an open source voxel game-creation platform with easy modding and game creation
|
||||||
|
org.opencontainers.image.licenses=LGPL-2.1-only
|
||||||
|
|
||||||
|
# Login against the Docker registry except on PR
|
||||||
|
# https://github.com/docker/login-action
|
||||||
|
- name: Log into registry ${{ env.REGISTRY }}
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v3.4.0
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Get image name
|
||||||
|
run:
|
||||||
|
echo "IMAGE_NAME_LOWERCASE"="${IMAGE_NAME,,}" >> $GITHUB_ENV
|
||||||
|
|
||||||
# Build and push Docker image
|
- name: Build and push by digest
|
||||||
# https://github.com/docker/build-push-action
|
id: build
|
||||||
# No arm support for now. Require cross-compilation support in Dockerfile to not use QEMU.
|
uses: docker/build-push-action@v6.15.0
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5.1.0
|
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64
|
platforms: ${{ matrix.platform }}
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
load: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
annotations: ${{ steps.meta.outputs.annotations }}
|
||||||
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWERCASE }}
|
||||||
|
outputs: type=image,push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
no-cache: ${{ (github.event_name == 'workflow_dispatch' && !inputs.use_cache) || startsWith(github.ref, 'refs/tags/') }}
|
no-cache: ${{ (github.event_name == 'workflow_dispatch' && !inputs.use_cache) || startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
|
||||||
- name: Test Docker Image
|
- name: Export digest
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
run: |
|
run: |
|
||||||
docker run --rm $(cut -d, -f1 <<<"$DOCKER_METADATA_OUTPUT_TAGS") luantiserver --version
|
mkdir -p ${{ runner.temp }}/digests
|
||||||
shell: bash
|
digest="${{ steps.build.outputs.digest }}"
|
||||||
|
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
||||||
|
|
||||||
|
- name: Upload digest
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
with:
|
||||||
|
name: digests-${{ env.PLATFORM_PAIR }}
|
||||||
|
path: ${{ runner.temp }}/digests/*
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
push:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
needs: build
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download digests
|
||||||
|
uses: actions/download-artifact@v4.2.1
|
||||||
|
with:
|
||||||
|
path: ${{ runner.temp }}/digests
|
||||||
|
pattern: digests-*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Get image name
|
||||||
|
run:
|
||||||
|
echo "IMAGE_NAME_LOWERCASE"="${IMAGE_NAME,,}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Login against the Docker registry except on PR
|
||||||
|
# https://github.com/docker/login-action
|
||||||
|
- name: Log into registry ${{ env.REGISTRY }}
|
||||||
|
uses: docker/login-action@v3.4.0
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Setup Docker buildx
|
||||||
|
uses: docker/setup-buildx-action@v3.10.0
|
||||||
|
|
||||||
|
# Extract metadata (tags, labels, annotations) for Docker
|
||||||
|
# https://github.com/docker/metadata-action
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5.7.0
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=Luanti
|
||||||
|
org.opencontainers.image.vendor=Luanti
|
||||||
|
org.opencontainers.image.description=Luanti (formerly Minetest) is an open source voxel game-creation platform with easy modding and game creation
|
||||||
|
org.opencontainers.image.licenses=LGPL-2.1-only
|
||||||
|
annotations: |
|
||||||
|
org.opencontainers.image.title=Luanti
|
||||||
|
org.opencontainers.image.vendor=Luanti
|
||||||
|
org.opencontainers.image.description=Luanti (formerly Minetest) is an open source voxel game-creation platform with easy modding and game creation
|
||||||
|
org.opencontainers.image.licenses=LGPL-2.1-only
|
||||||
|
|
||||||
|
- name: Create manifest list and push
|
||||||
|
working-directory: ${{ runner.temp }}/digests
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
||||||
|
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWERCASE }}@sha256:%s ' *)
|
||||||
|
|
||||||
|
- name: Inspect image
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWERCASE }}:${{ steps.meta.outputs.version }}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
# check=error=true
|
||||||
|
|
||||||
ARG DOCKER_IMAGE=alpine:3.19
|
ARG DOCKER_IMAGE=alpine:3.19
|
||||||
FROM $DOCKER_IMAGE AS dev
|
FROM $DOCKER_IMAGE AS dev
|
||||||
|
|
||||||
ENV LUAJIT_VERSION v2.1
|
ENV LUAJIT_VERSION=v2.1
|
||||||
|
|
||||||
RUN apk add --no-cache git build-base cmake curl-dev zlib-dev zstd-dev \
|
RUN apk add --no-cache git build-base cmake curl-dev zlib-dev zstd-dev \
|
||||||
sqlite-dev postgresql-dev hiredis-dev leveldb-dev \
|
sqlite-dev postgresql-dev hiredis-dev leveldb-dev \
|
||||||
|
@ -30,7 +33,7 @@ RUN git clone --recursive https://github.com/jupp0r/prometheus-cpp && \
|
||||||
make amalg && make install && \
|
make amalg && make install && \
|
||||||
cd /usr/src/
|
cd /usr/src/
|
||||||
|
|
||||||
FROM dev as builder
|
FROM dev AS builder
|
||||||
|
|
||||||
COPY .git /usr/src/luanti/.git
|
COPY .git /usr/src/luanti/.git
|
||||||
COPY CMakeLists.txt /usr/src/luanti/CMakeLists.txt
|
COPY CMakeLists.txt /usr/src/luanti/CMakeLists.txt
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue