Initial commit
This commit is contained in:
37
Dockerfile.deps
Normal file
37
Dockerfile.deps
Normal file
@@ -0,0 +1,37 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
# Heavy layer: Ruby gems + system packages. Rebuild only when Gemfile.lock changes.
|
||||
# docker build -f Dockerfile.deps -t custom/dena-deps:1 .
|
||||
FROM ruby:2.7.8
|
||||
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
ENV KAIGARA_VERSION=0.1.9
|
||||
|
||||
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 vim \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& gem install bundler:2.2.16 \
|
||||
&& curl -fsSL -o /usr/bin/kaigara "https://github.com/openware/kaigara/releases/download/${KAIGARA_VERSION}/kaigara" \
|
||||
&& chmod +x /usr/bin/kaigara
|
||||
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
|
||||
RUN mkdir -p ${BUNDLE_PATH} \
|
||||
&& chown -R app:app /opt/vendor ${APP_HOME} \
|
||||
&& su app -s /bin/bash -c "bundle config set --local path ${BUNDLE_PATH} \
|
||||
&& bundle install --jobs $(nproc)"
|
||||
|
||||
USER app
|
||||
ENV PATH="${BUNDLE_PATH}/bin:${PATH}"
|
||||
Reference in New Issue
Block a user