-
Notifications
You must be signed in to change notification settings - Fork 30
/
Dockerfile
72 lines (54 loc) · 3.5 KB
/
Dockerfile
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
66
67
68
69
70
71
72
ARG deps="findutils hostname jq libpq openssl procps-ng ruby shared-mime-info tzdata"
ARG devDeps="gcc gcc-c++ gzip libffi-devel libyaml-devel make openssl-devel patch postgresql postgresql-devel redhat-rpm-config ruby-devel tar which util-linux xz"
ARG extras=""
ARG prod="true"
ARG pgRepo="https://copr.fedorainfracloud.org/coprs/mmraka/postgresql-16/repo/epel-8/mmraka-postgresql-16-epel-8.repo"
FROM registry.access.redhat.com/ubi8/ubi-minimal AS build
ARG deps
ARG devDeps
ARG extras
ARG prod
ARG pgRepo
ARG IMAGE_TAG
USER 0
WORKDIR /opt/app-root/src
COPY ./.gemrc.prod /etc/gemrc
COPY ./Gemfile.lock ./Gemfile /opt/app-root/src/
RUN (microdnf module enable -y postgresql:16 || curl -o /etc/yum.repos.d/postgresql.repo $pgRepo) && \
rpm -e --nodeps tzdata &>/dev/null && \
microdnf module enable -y ruby:3.3 && \
microdnf install --nodocs -y $deps $devDeps $extras && \
chmod +t /tmp && \
gem update --system -N --install-dir=/usr/share/gems --bindir /usr/bin && \
gem install bundler && \
( [[ $prod != "true" ]] || bundle config set --local --without 'development:test' ) && \
( [[ $prod != "true" ]] || bundle config set --local deployment 'true' ) && \
( [[ $prod != "true" ]] || bundle config set --local path './.bundle' ) && \
bundle config set --local retry '2' && \
bundle config set --local force_ruby_platform true && \
bundle config set --local build.ffi --enable-system-libffi && \
( [[ $prod != "true" ]] || bundle install --without development test ) && \
( [[ $prod == "true" ]] || bundle install ) && \
microdnf clean all -y && \
( [[ $prod != "true" ]] || bundle clean -V )
LABEL BUILD_STAGE_OF=$IMAGE_TAG
ENV prometheus_multiproc_dir=/opt/app-root/src/tmp prometheus_rust_mmaped_file=false
#############################################################
FROM registry.access.redhat.com/ubi8/ubi-minimal
ARG deps
ARG devDeps
WORKDIR /opt/app-root/src
USER 0
RUN rpm -e --nodeps tzdata &>/dev/null && \
microdnf module enable -y ruby:3.3 && \
microdnf install --nodocs -y $deps && \
chmod +t /tmp && \
gem update --system -N --install-dir=/usr/share/gems --bindir /usr/bin && \
microdnf clean all -y && \
chown 1001:root ./ && \
install -v -d -m 1777 -o 1001 ./tmp ./log
USER 1001
COPY --chown=1001:0 . /opt/app-root/src
COPY --chown=1001:0 --from=build /opt/app-root/src/.bundle /opt/app-root/src/.bundle
ENV RAILS_ENV=production RAILS_LOG_TO_STDOUT=true HOME=/opt/app-root/src DEV_DEPS=$devDeps prometheus_multiproc_dir=/opt/app-root/src/tmp prometheus_rust_mmaped_file=false
CMD ["/opt/app-root/src/entrypoint.sh"]