namespace cache IDs by TARGETARCH
Some checks failed
Ruby Lint / lint (push) Successful in 39s
Release / docker (push) Has been cancelled
Ruby Test / test (push) Has been cancelled

This commit is contained in:
2025-06-28 14:03:55 -05:00
parent 653167adb5
commit 8979b22154
2 changed files with 13 additions and 9 deletions

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,19 +13,19 @@ 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
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
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 . .