-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
94 lines (78 loc) · 3.04 KB
/
Dockerfile
File metadata and controls
94 lines (78 loc) · 3.04 KB
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
##########################################################################
## Dockerfile for SA@OSU
##########################################################################
FROM ruby:2.7-slim-bullseye AS bundler
# Necessary for bundler to properly install some gems
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
##########################################################################
## Install dependencies
##########################################################################
FROM bundler AS dependencies
RUN apt update && apt -y upgrade && \
apt -y install \
nodejs \
ghostscript \
vim \
yarn \
git \
cron \
mariadb-client libmariadb-dev \
curl wget \
less \
build-essential \
tzdata \
zip \
libtool \
bash bash-completion \
java-common openjdk-17-jre-headless \
python-is-python3 \
ffmpeg mediainfo exiftool \
libpng-dev libjpeg-dev libtiff-dev libwebp-dev \
libfreetype6-dev libfontconfig1-dev \
libxml2-dev libltdl-dev
# Install ImageMagick 7 from source directly
RUN wget https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.0.11-14.tar.gz -O /tmp/im.tar.gz && \
tar xzf /tmp/im.tar.gz -C /tmp && \
cd /tmp/ImageMagick-7.0.11-14 && \
./configure --with-jpeg --with-png --with-tiff --with-webp --with-freetype --with-xml && \
make -j$(nproc) && make install && ldconfig && \
rm -rf /tmp/im.tar.gz /tmp/ImageMagick-7.0.11-14
# Set the timezone to America/Los_Angeles (Pacific) then get rid of tzdata
RUN cp -f /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && \
echo 'America/Los_Angeles' > /etc/timezone
# download and install FITS from Github
RUN mkdir -p /opt/fits && \
curl -fSL -o /opt/fits-1.6.0.zip https://github.com/harvard-lts/fits/releases/download/1.6.0/fits-1.6.0.zip && \
cd /opt/fits && unzip /opt/fits-1.6.0.zip && chmod +X fits.sh && \
rm -f /opt/fits-1.6.0.zip && \
rm /opt/fits/tools/mediainfo/linux/libmediainfo.so.0
##########################################################################
## Add our Gemfile and install our gems
##########################################################################
FROM dependencies AS gems
RUN mkdir /data
WORKDIR /data
ADD Gemfile /data/Gemfile
ADD Gemfile.lock /data/Gemfile.lock
RUN mkdir /data/build
ARG RAILS_ENV=${RAILS_ENV}
ENV RAILS_ENV=${RAILS_ENV}
ADD ./build/install_gems.sh /data/build
RUN ./build/install_gems.sh && bundle clean --force
##########################################################################
## Add code to the container, clean up any garbage
##########################################################################
FROM gems AS code
#USER root
# Uninstall any dev tools we don't need at runtime
RUN apt --purge -y autoremove gcc g++
ADD . /data
## Precompile assets
FROM code
RUN if [ "${RAILS_ENV}" == "production" -o "$RAILS_ENV" == "staging" ]; then \
echo "Precompiling assets with $RAILS_ENV environment"; \
RAILS_ENV=$RAILS_ENV SECRET_KEY_BASE=temporary bundle exec rails assets:precompile; \
cp public/assets/404-*.html public/404.html; \
cp public/assets/500-*.html public/500.html; \
fi