-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (48 loc) · 1.56 KB
/
Dockerfile
File metadata and controls
65 lines (48 loc) · 1.56 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM ruby:3.3-slim AS base
USER root
# Configure users and groups
RUN groupadd -g 40054 alma && \
useradd -r -s /sbin/nologin -M -u 40054 -g alma alma && \
useradd -u 40061 bfs && \
groupadd -g 40061 bfs && \
usermod -u 40061 -g bfs -G alma -l bfs default && \
find / -user 1001 -exec chown -h bfs {} \; || true && \
mkdir -p /opt/app && \
chown -R bfs:bfs /opt/app
# Get list of available packages
RUN apt-get -y update -qq
COPY --chown=bfs . /opt/app
ENTRYPOINT ["/opt/app/bin/bfs"]
CMD ["help"]
# ===============================================
# Target: development
# ===============================================
FROM base AS development
USER root
RUN apt-get -y --no-install-recommends install \
build-essential \
make
USER bfs
# Base image ships with an older version of bundler
RUN gem install bundler --version 2.5.22
WORKDIR /opt/app
COPY --chown=bfs Gemfile* .ruby-version ./
RUN bundle config set force_ruby_platform true
RUN bundle config set system 'true'
RUN bundle install
# =================================
# Target: production
# =================================
FROM base AS production
# Copy the built codebase from the dev stage
COPY --from=development --chown=bfs /usr/local/bundle /usr/local/bundle
# =================================
# Target: production
# =================================
FROM base AS production
# Copy the built codebase from the dev stage
COPY --from=development --chown=bfs /usr/local/bundle /usr/local/bundle
USER bfs
WORKDIR /opt/app
RUN bundle config set frozen 'true'
RUN bundle install --local