generated from mlibrary/ruby-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.prod
35 lines (23 loc) · 886 Bytes
/
Dockerfile.prod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
ARG RUBY_VERSION=3.2
FROM ruby:${RUBY_VERSION}
# Last digit is needed to get bundler to install the latest.
# Check https://rubygems.org/gems/bundler/versions for the latest version.
ARG UNAME=app
ARG UID=1000
ARG GID=1000
LABEL maintainer="[email protected]"
## Install Vim (optional)
#RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
# vim-tiny
RUN gem install bundler
RUN groupadd -g ${GID} -o ${UNAME}
RUN useradd -m -d /app -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME}
RUN mkdir -p /gems && chown ${UID}:${GID} /gems
ENV BUNDLE_PATH /gems
WORKDIR /app
##For a production build copy the app files and run bundle install
COPY --chown=${UID}:${GID} . /app
RUN --mount=type=secret,id=gh_package_read_token \
read_token="$(cat /run/secrets/gh_package_read_token)" \
&& BUNDLE_RUBYGEMS__PKG__GITHUB__COM=${read_token} bundle install
USER $UNAME