forked from samvera/hyrax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
119 lines (83 loc) · 3.13 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
ARG ALPINE_VERSION=3.18
ARG RUBY_VERSION=3.2.2
FROM ruby:$RUBY_VERSION-alpine$ALPINE_VERSION as builder
RUN apk add build-base curl jemalloc
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 \
curl \
gcompat \
imagemagick \
tzdata \
nodejs \
yarn \
zip \
$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/samvera/hyrax-webapp
WORKDIR /app/samvera/hyrax-webapp
COPY --chown=1001:101 ./bin /app/samvera
ENV PATH="/app/samvera:$PATH"
ENV RAILS_ROOT="/app/samvera/hyrax-webapp"
ENV RAILS_SERVE_STATIC_FILES="1"
COPY --from=builder /usr/lib/libjemalloc.so.2 /usr/local/lib/
ENV LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
ENTRYPOINT ["hyrax-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="development test"
ONBUILD COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
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
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="development test"
ONBUILD COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
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
FROM hyrax-base as hyrax-engine-dev
ARG APP_PATH=.dassie
ARG BUNDLE_WITHOUT=
ENV HYRAX_ENGINE_PATH /app/samvera/hyrax-engine
COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
COPY --chown=1001:101 . /app/samvera/hyrax-engine
RUN bundle -v && \
bundle install --jobs "$(nproc)" && \
cd $HYRAX_ENGINE_PATH && \
bundle install --jobs "$(nproc)" && \
yarn
RUN RAILS_ENV=production SECRET_KEY_BASE='fakesecret1234' DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
FROM hyrax-worker-base as hyrax-engine-dev-worker
ARG APP_PATH=.dassie
ARG BUNDLE_WITHOUT=
ENV HYRAX_ENGINE_PATH /app/samvera/hyrax-engine
COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
COPY --chown=1001:101 . /app/samvera/hyrax-engine
RUN bundle install --jobs "$(nproc)"