-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
68 lines (52 loc) · 1.52 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
# Stage 1: Build
FROM ruby:3.3.6-alpine3.20 AS builder
LABEL maintainer="Gil Desmarais <[email protected]>"
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
WORKDIR /app
COPY Gemfile Gemfile.lock ./
# hadolint ignore=SC2046
RUN apk add --no-cache \
'gcc>=12' \
'git>=2' \
'libc-dev>=0.7' \
'make>=4' \
'openssl>=3' \
'libxml2-dev>=2' \
'libxslt-dev>=1' \
&& gem install bundler:$(tail -1 Gemfile.lock | tr -d ' ') \
&& bundle config set --local without 'development test' \
&& bundle install --retry=5 --jobs=$(nproc) \
&& bundle binstubs bundler html2rss
# Stage 2: Runtime
FROM ruby:3.3.6-alpine3.20
LABEL maintainer="Gil Desmarais <[email protected]>"
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
ENV PORT=3000 \
RACK_ENV=production \
RUBY_YJIT_ENABLE=1
EXPOSE $PORT
HEALTHCHECK --interval=30m --timeout=60s --start-period=5s \
CMD curl -f http://${HEALTH_CHECK_USERNAME}:${HEALTH_CHECK_PASSWORD}@localhost:${PORT}/health_check.txt || exit 1
ARG USER=html2rss
ARG UID=991
ARG GID=991
RUN apk add --no-cache \
'gcompat>=0' \
'tzdata>=2024' \
'libxml2>=2' \
'libxslt>=1' \
&& addgroup --gid "$GID" "$USER" \
&& adduser \
--disabled-password \
--gecos "" \
--home "/app" \
--ingroup "$USER" \
--no-create-home \
--uid "$UID" "$USER" \
&& mkdir -p /app \
&& chown "$USER":"$USER" -R /app
WORKDIR /app
USER html2rss
COPY --from=builder /usr/local/bundle /usr/local/bundle
COPY --chown=$USER:$USER . /app
CMD ["bundle", "exec", "puma", "-C", "./config/puma.rb"]