Files
Dalan/Dockerfile.deps
2026-08-13 19:56:46 +03:30

36 lines
1.1 KiB
Docker

# syntax=docker/dockerfile:1.4
# Heavy layer: Ruby gems + system packages. Rebuild only when Gemfile.lock changes.
# docker build -f Dockerfile.deps -t custom/dalan-deps:1 .
FROM ruby:2.7.8
ARG UID=1000
ARG GID=1000
ENV APP_HOME=/home/app \
BUNDLE_PATH=/opt/vendor/bundle \
TZ=UTC
RUN groupadd -r --gid ${GID} app \
&& useradd --system --create-home --home ${APP_HOME} --shell /sbin/nologin --no-log-init \
--gid ${GID} --uid ${UID} app
WORKDIR $APP_HOME
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update \
&& apt-get install -y --no-install-recommends default-libmysqlclient-dev git curl wget \
&& rm -rf /var/lib/apt/lists/* \
&& gem install bundler:2.2.16
COPY Gemfile Gemfile.lock ./
RUN mkdir -p ${BUNDLE_PATH} \
&& chown -R app:app ${BUNDLE_PATH} ${APP_HOME} \
&& su app -s /bin/bash -c "bundle config set --local path ${BUNDLE_PATH} \
&& bundle config set --local without 'development test' \
&& bundle install --jobs $(nproc)"
USER app
ENV PATH="${BUNDLE_PATH}/bin:${PATH}"