|
1 | 1 | # https://hub.docker.com/r/stefansundin/rssbox |
2 | 2 | # docker pull stefansundin/rssbox |
3 | | -# docker run -i -t -p 3000:3000 stefansundin/rssbox |
4 | | -# docker run -i -t --entrypoint bin/cons stefansundin/rssbox |
| 3 | +# docker run --rm -it -p 3000:3000 stefansundin/rssbox |
| 4 | +# docker run --rm -it --entrypoint bin/cons stefansundin/rssbox |
5 | 5 |
|
6 | 6 | # docker network create rssbox |
7 | 7 | # docker run --rm --network=rssbox --name=redis redis redis-server --appendonly yes |
|
17 | 17 | # Push to public ECR: |
18 | 18 | # docker buildx imagetools create -t public.ecr.aws/stefansundin/rssbox stefansundin/rssbox |
19 | 19 |
|
20 | | -FROM stefansundin/ruby:3.4-jemalloc |
| 20 | +# Verify jemalloc: |
| 21 | +# docker run --rm -it --entrypoint ruby -e MALLOC_CONF=stats_print:true stefansundin/rssbox -- -e exit |
| 22 | +# Verify YJIT: |
| 23 | +# docker run --rm -it --entrypoint ruby -e RUBYOPT="--yjit" stefansundin/rssbox -e "puts RUBY_DESCRIPTION" |
| 24 | + |
| 25 | +FROM ruby:3.4 AS builder |
| 26 | + |
| 27 | +RUN echo 'gem: --no-document' >> /usr/local/etc/gemrc |
| 28 | + |
| 29 | +WORKDIR /app |
| 30 | +COPY Gemfile Gemfile.lock ./ |
| 31 | + |
| 32 | +RUN bundle config set --local without development:test |
| 33 | +RUN bundle config set --local deployment true |
| 34 | +RUN bundle install --retry=3 --jobs=4 |
| 35 | + |
| 36 | + |
| 37 | +FROM ruby:3.4-slim |
| 38 | + |
21 | 39 | LABEL org.opencontainers.image.authors="Stefan Sundin" |
22 | 40 | LABEL org.opencontainers.image.url="https://github.com/stefansundin/rssbox" |
23 | 41 |
|
24 | | -# install system utilities that are useful when debugging |
25 | 42 | RUN \ |
26 | 43 | apt-get update && \ |
27 | 44 | apt-get upgrade -y && \ |
28 | 45 | apt-get install -y --no-install-recommends \ |
| 46 | + libjemalloc2 \ |
| 47 | + rustc \ |
| 48 | + git \ |
29 | 49 | vim less && \ |
30 | 50 | apt-get clean && \ |
31 | 51 | rm -rf /var/lib/apt/lists/* |
32 | 52 |
|
| 53 | +RUN ln -s $(uname -m)-linux-gnu/libjemalloc.so.2 /usr/lib/libjemalloc.so.2 |
| 54 | +ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2 |
| 55 | +ENV MALLOC_ARENA_MAX=2 |
| 56 | + |
| 57 | +ENV APP_ENV=production |
| 58 | + |
33 | 59 | WORKDIR /app |
34 | | -COPY Gemfile Gemfile.lock ./ |
35 | | -RUN bundle config set --local without development:test |
36 | | -RUN bundle config set --local deployment true |
37 | | -RUN bundle install --retry=3 --jobs=4 |
| 60 | +COPY --from=builder /usr/local/etc/gemrc /usr/local/etc/gemrc |
| 61 | +COPY --from=builder /usr/local/bundle/config /usr/local/bundle/config |
| 62 | +COPY --from=builder /app /app |
| 63 | + |
| 64 | +RUN bundle check |
| 65 | + |
38 | 66 | COPY . . |
39 | 67 | RUN find -not -path './vendor/*' |
40 | 68 |
|
|
0 commit comments