simplify the Dockerfiles
- remove the caching, it's more trouble than it's worth - use '&&' instead of ';', so it fails earlier
This commit is contained in:
@ -3,8 +3,6 @@ ARG BASE_REGISTRY="docker.io"
|
||||
|
||||
FROM ${BASE_REGISTRY}/ruby:${RUBY_VERSION}-alpine AS base
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
ENV RACK_ENV="production" \
|
||||
BUNDLE_DEPLOYMENT=true \
|
||||
BUNDLE_PATH="/usr/local/bundle" \
|
||||
@ -14,23 +12,21 @@ ENV RACK_ENV="production" \
|
||||
WORKDIR /kubernaut
|
||||
|
||||
RUN \
|
||||
--mount=type=cache,id=var-cache-apk-${TARGETARCH},target=/var/cache/apk,sharing=locked \
|
||||
apk update -q; \
|
||||
apk update -q && \
|
||||
apk add bash jemalloc
|
||||
|
||||
FROM base AS build
|
||||
|
||||
RUN \
|
||||
--mount=type=cache,id=var-cache-apk-${TARGETARCH},target=/var/cache/apk,sharing=locked \
|
||||
apk update -q; \
|
||||
apk add musl-dev gcc make; \
|
||||
apk update -q && \
|
||||
apk add musl-dev gcc make && \
|
||||
apk add bash jemalloc
|
||||
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
|
||||
RUN \
|
||||
--mount=type=cache,id=usr-local-bundle-ruby-cache-${TARGETARCH},target=${BUNDLE_PATH}/ruby/3.4.0/cache,sharing=locked \
|
||||
bundle install
|
||||
bundle install && \
|
||||
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
|
||||
|
||||
COPY . .
|
||||
|
||||
@ -39,7 +35,7 @@ FROM base
|
||||
ENV PORT=4567
|
||||
|
||||
RUN \
|
||||
addgroup --system --gid 666 kubernaut; \
|
||||
addgroup --system --gid 666 kubernaut && \
|
||||
adduser --system --uid 666 --ingroup kubernaut --shell /bin/bash --disabled-password kubernaut
|
||||
|
||||
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
||||
|
Reference in New Issue
Block a user