2 Commits

Author SHA1 Message Date
54dcec73f6 namespace cache IDs by TARGETARCH
Some checks failed
Ruby Lint / lint (push) Successful in 16s
Ruby Test / test (push) Has been cancelled
Release / docker (push) Has been cancelled
2025-06-28 14:03:55 -05:00
653167adb5 add arm64 build target
Some checks failed
Ruby Lint / lint (push) Successful in 16s
Ruby Test / test (push) Successful in 31s
Release / docker (push) Has been cancelled
2025-06-28 13:12:17 -05:00
3 changed files with 17 additions and 9 deletions

View File

@ -9,6 +9,10 @@ target "_common" {
args = {
RUBY_VERSION = "3.4.4"
}
platforms = [
"linux/amd64",
"linux/arm64",
]
}
target "bookworm" {

View File

@ -1,5 +1,7 @@
ARG RUBY_VERSION="3.4.4"
ARG BASE_REGISTRY="docker.io"
ARG TARGETARCH
FROM ${BASE_REGISTRY}/ruby:${RUBY_VERSION}-alpine AS base
ENV RACK_ENV="production" \
@ -11,7 +13,7 @@ ENV RACK_ENV="production" \
WORKDIR /kubernaut
RUN \
--mount=type=cache,id=var-cache-apk,target=/var/cache/apk,sharing=locked \
--mount=type=cache,id=var-cache-apk-${TARGETARCH},target=/var/cache/apk,sharing=locked \
apk update -q; \
apk add bash jemalloc
@ -23,7 +25,7 @@ RUN \
FROM base AS build
RUN \
--mount=type=cache,id=var-cache-apk,target=/var/cache/apk,sharing=locked \
--mount=type=cache,id=var-cache-apk-${TARGETARCH},target=/var/cache/apk,sharing=locked \
apk update -q; \
apk add musl-dev gcc make; \
apk add bash jemalloc
@ -31,7 +33,7 @@ RUN \
COPY Gemfile Gemfile.lock ./
RUN \
--mount=type=cache,id=usr-local-bundle-ruby-cache,target=${BUNDLE_PATH}/ruby/3.4.0/cache,sharing=locked \
--mount=type=cache,id=usr-local-bundle-ruby-cache-${TARGETARCH},target=${BUNDLE_PATH}/ruby/3.4.0/cache,sharing=locked \
bundle install
COPY . .

View File

@ -1,6 +1,8 @@
ARG RUBY_VERSION="3.4.4"
ARG BASE_REGISTRY="docker.io"
ARG DEBIAN_VERSION="bookworm"
ARG TARGETARCH
FROM ${BASE_REGISTRY}/ruby:${RUBY_VERSION}-slim-${DEBIAN_VERSION} AS base
ENV RACK_ENV="production" \
@ -14,14 +16,14 @@ WORKDIR /kubernaut
RUN rm -f /etc/apt/apt.conf.d/docker-clean
RUN \
--mount=type=cache,id=var-cache-apt,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=var-lib-apt,target=/var/lib/apt,sharing=locked \
--mount=type=cache,id=var-cache-apt-${TARGETARCH},target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=var-lib-apt-${TARGETARCH},target=/var/lib/apt,sharing=locked \
apt-get update -qq; \
apt-get install --yes --no-install-recommends \
libjemalloc2
RUN \
--mount=type=cache,id=usr-local-bundle-cache,target=${BUNDLE_PATH},sharing=locked \
--mount=type=cache,id=usr-local-bundle-cache-${TARGETARCH},target=${BUNDLE_PATH},sharing=locked \
gem update --system --no-document; \
gem install -N bundler
@ -30,8 +32,8 @@ ENV DEBIAN_FRONTEND="noninteractive"
FROM base AS build
RUN \
--mount=type=cache,id=var-cache-apt,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=var-lib-apt,target=/var/lib/apt,sharing=locked \
--mount=type=cache,id=var-cache-apt-${TARGETARCH},target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=var-lib-apt-${TARGETARCH},target=/var/lib/apt,sharing=locked \
apt-get update -qq; \
apt-get install --yes --no-install-recommends \
build-essential
@ -39,7 +41,7 @@ RUN \
COPY Gemfile Gemfile.lock ./
RUN \
--mount=type=cache,id=usr-local-bundle-ruby-cache,target=${BUNDLE_PATH}/ruby/3.4.0/cache,sharing=locked \
--mount=type=cache,id=usr-local-bundle-ruby-cache-${TARGETARCH},target=${BUNDLE_PATH}/ruby/3.4.0/cache,sharing=locked \
bundle install
COPY . .