-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
89 lines (73 loc) · 2.71 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
##########################################################################
## 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
# Install ImageMagick with full support
RUN t=$(mktemp) && \
wget 'https://raw.githubusercontent.com/SoftCreatR/imei/main/imei.sh' -qO "$t" && \
bash "$t" --imagemagick-version=7.0.11-14 --skip-jxl && \
rm "$t"
# 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