-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
96 lines (74 loc) · 2.27 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
ARG ALPINE_VERSION=3.19
ARG RUBY_VERSION=3.2.3
FROM ruby:$RUBY_VERSION-alpine$ALPINE_VERSION as hyrax-base
ARG DATABASE_APK_PACKAGE="postgresql-dev"
ARG EXTRA_APK_PACKAGES="git"
ARG RUBYGEMS_VERSION=""
RUN apk --no-cache upgrade && \
apk --no-cache add acl \
build-base \
bash \
curl \
gcompat \
imagemagick \
imagemagick-heic \
imagemagick-jpeg \
imagemagick-jxl \
imagemagick-pdf \
imagemagick-svg \
imagemagick-tiff \
imagemagick-webp \
libxml2-dev \
jemalloc \
tzdata \
nodejs \
yarn \
zip \
ffmpeg \
mediainfo \
perl \
$DATABASE_APK_PACKAGE \
$EXTRA_APK_PACKAGES
RUN setfacl -d -m o::rwx /usr/local/bundle && \
gem update --system $RUBYGEMS_VERSION
RUN addgroup -S --gid 101 app && \
adduser -S -G app -u 1001 -s /bin/sh -h /app app
USER app
RUN mkdir -p /app
WORKDIR /app
COPY --chown=1001:101 ./scripts/*.sh /app/scripts/
ENV RAILS_ROOT="/app" \
RAILS_SERVE_STATIC_FILES="1" \
LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
ENTRYPOINT ["./scripts/entrypoint.sh"]
CMD ["bundle", "exec", "puma", "-v", "-b", "tcp://0.0.0.0:3000"]
FROM hyrax-base as hyrax
ARG APP_PATH=.
ARG BUNDLE_WITHOUT=
ONBUILD COPY --chown=1001:101 $APP_PATH /app
ONBUILD RUN bundle install --jobs "$(nproc)"
ONBUILD RUN yarn
ONBUILD RUN RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
FROM hyrax-base as hyrax-worker-base
USER root
RUN apk --no-cache add bash \
ffmpeg \
mediainfo \
openjdk17-jre \
perl
USER app
RUN mkdir -p /app/fits && \
cd /app/fits && \
wget https://github.com/harvard-lts/fits/releases/download/1.6.0/fits-1.6.0.zip -O fits.zip && \
unzip fits.zip && \
rm fits.zip tools/mediainfo/linux/libmediainfo.so.0 tools/mediainfo/linux/libzen.so.0 && \
chmod a+x /app/fits/fits.sh && \
sed -i 's/\(<tool.*TikaTool.*>\)/<!--\1-->/' /app/fits/xml/fits.xml
ENV PATH="${PATH}:/app/fits"
CMD bundle exec sidekiq
FROM hyrax-worker-base as hyrax-worker
ARG APP_PATH=.
ARG BUNDLE_WITHOUT=
ONBUILD COPY --chown=1001:101 $APP_PATH /app
ONBUILD RUN bundle install --jobs "$(nproc)"
ONBUILD RUN RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile