/
Dockerfile.prod
55 lines (44 loc) · 1.47 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Allow base image override
ARG BASE_IMAGE="harbor.k8s.temple.edu/library/ruby:3.2-alpine"
# hadolint ignore=DL3006,DL3026
FROM "${BASE_IMAGE}"
WORKDIR /app
COPY . .
ENV LD_PRELOAD="libjemalloc.so.2" \
MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true" \
WEB_CONCURRENCY="8" \
RUBY_YJIT_ENABLE="1"
USER root
ARG SECRET_KEY_BASE
# libc6-compat is required for m1 build.
RUN apk add -U --no-cache \
jemalloc=5.3.0-r4 \
bash=5.2.21-r0 \
libc6-compat=1.1.0-r4 \
libxslt=1.1.39-r0 \
mariadb-connector-c=3.3.8-r0 \
shared-mime-info=2.4-r0 \
tzdata=2024a-r0 && \
apk add -U --no-cache --virtual build-dependencies \
build-base=0.5-r3 \
git=2.43.0-r0 \
libxslt-dev=1.1.39-r0 \
mariadb-dev=10.11.6-r0 \
nodejs=20.11.1-r0 \
yarn=1.22.19-r0 && \
bundle config set --local without "development test" && \
bundle install --jobs=8 && \
find "$GEM_HOME" -name yarn.lock -exec rm "{}" \; && \
cp config/alma.yml.example config/alma.yml && \
cp config/bento.yml.example config/bento.yml && \
RAILS_ENV=production SECRET_KEY_BASE=$SECRET_KEY_BASE bundle exec rails assets:precompile && \
rm -rf node_modules && \
rm -rf tmp/* && \
apk del build-dependencies && \
rm -rf /var/cache/apk/ && \
chown nobody -R /app/tmp && \
chown nobody -R /app/log
USER nobody
ENTRYPOINT [".docker/app/entrypoint.sh"]
EXPOSE 3000
CMD ["rails", "server", "-b", "0.0.0.0"]