-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (29 loc) · 940 Bytes
/
Dockerfile
File metadata and controls
45 lines (29 loc) · 940 Bytes
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
FROM ruby:3.4.7-alpine3.22 AS base
ENV LANG=C.UTF-8
ENV APP_ROOT=/app
#################################################
FROM base AS builder
RUN apk add --update --no-cache build-base git yaml-dev imagemagick tiff-tools jemalloc
WORKDIR $APP_ROOT
COPY Gemfile* /app/
RUN gem install bundler \
&& bundle install \
&& rm -rf /usr/local/bundle/*/*/cache \
&& find /usr/local/bundle -name "*.c" -delete \
&& find /usr/local/bundle -name "*.o" -delete
#################################################
FROM base
ENV RACK_ENV=production
ENV RUBY_YJIT_ENABLE=1
ENV LD_PRELOAD=libjemalloc.so.2
RUN apk update \
&& apk upgrade \
&& apk --no-cache add imagemagick tiff-tools file gcompat
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
COPY . $APP_ROOT
WORKDIR $APP_ROOT
RUN addgroup ruby -g 3000 \
&& adduser -D -h /home/ruby -u 3000 -G ruby ruby
USER ruby
EXPOSE 4567
CMD ["bundle", "exec", "rackup", "-p", "4567"]