Skip to content
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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target
**/node_modules
.git
76 changes: 76 additions & 0 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Release image
on:
push:
tags:
- api-v*
permissions:
contents: read
packages: write
env:
IMAGE: ghcr.io/beyondoss/beyond-objects
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
arch: amd64
- runs-on: ubuntu-24.04-arm
arch: arm64
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: build
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/${{ matrix.arch }}
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=image-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=image-${{ matrix.arch }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- uses: actions/upload-artifact@v4
with:
name: digest-${{ matrix.arch }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digest-*
merge-multiple: true
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve version
id: meta
run: echo "version=${GITHUB_REF_NAME#api-v}" >> "$GITHUB_OUTPUT"
- name: Create manifest list
working-directory: /tmp/digests
run: |
docker buildx imagetools create \
-t ${{ env.IMAGE }}:${{ steps.meta.outputs.version }} \
-t ${{ env.IMAGE }}:latest \
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
- name: Inspect
run: docker buildx imagetools inspect ${{ env.IMAGE }}:${{ steps.meta.outputs.version }}
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# syntax=docker/dockerfile:1
# Slim release image for the beyond-objects server, published to
# ghcr.io/beyondoss/beyond-objects for local-dev / docker-compose use.
# Built and run on ubuntu:24.04 (noble) to match the production rootfs.
FROM ubuntu:24.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl ca-certificates clang libclang-dev pkg-config \
libssl-dev protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain 1.92.0 --profile minimal
WORKDIR /src
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/src/target,sharing=locked \
cargo build --release --bin beyond-objects \
&& cp /src/target/release/beyond-objects /usr/local/bin/beyond-objects \
&& strip /usr/local/bin/beyond-objects

FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl openssl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/beyond-objects /usr/local/bin/beyond-objects
EXPOSE 9000
ENTRYPOINT ["/usr/local/bin/beyond-objects", "serve"]
Loading