-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (64 loc) · 1.53 KB
/
Dockerfile
File metadata and controls
76 lines (64 loc) · 1.53 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
66
67
68
69
70
71
72
73
74
75
76
# =============================================
# Builder stage
# =============================================
FROM ruby:4.0.2-alpine AS builder
ENV APP_ROOT=/usr/src/app
ENV DATABASE_PORT=5432
WORKDIR $APP_ROOT
# Install build dependencies
RUN apk add --no-cache \
build-base \
git \
nodejs \
postgresql-dev \
tzdata \
curl-dev \
yaml-dev \
zlib-dev \
python3 \
py3-pip \
openjdk17-jre-headless \
diffoscope
# Install gems
COPY Gemfile Gemfile.lock $APP_ROOT/
RUN gem update --system \
&& gem install bundler foreman \
&& bundle config --global frozen 1 \
&& bundle config set without 'test' \
&& bundle install --jobs 2
# Copy application code
COPY . $APP_ROOT
# Precompile bootsnap and assets
RUN RAILS_ENV=production bundle exec rake assets:precompile
# =============================================
# Final stage
# =============================================
FROM ruby:4.0.2-alpine
ENV APP_ROOT=/usr/src/app
ENV DATABASE_PORT=5432
ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2
ENV RUBY_YJIT_ENABLE=1
WORKDIR $APP_ROOT
# Install runtime dependencies
RUN apk add --no-cache \
bash \
nodejs \
postgresql-libs \
tzdata \
curl \
yaml \
jemalloc \
python3 \
py3-pip \
openjdk17-jre-headless \
diffoscope \
netcat-openbsd \
git
# Install Python packages
RUN pip3 install --no-cache-dir --break-system-packages jsbeautifier tlsh
# Copy gems from builder
COPY --from=builder /usr/local/bundle /usr/local/bundle
# Copy application code
COPY --from=builder $APP_ROOT $APP_ROOT
# Startup
CMD ["bin/docker-start"]