-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
97 lines (81 loc) · 3.54 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
# Opted for including compiled css files from elements directly into the repo to:
# 1. speed-up image built;
# 2. enable updates for test deployment via mounted source code
# FROM node:20 AS elements
# RUN git clone https://github.com/epfl-si/elements.git
# WORKDIR /elements
# # Strip includes from bootstrap-variables.scss. We are only interested in the base vars, not functions.
# RUN yarn
# RUN rm -f bootstrap-variables.scss && yarn dist
# RUN grep -E -v "^@include" assets/config/bootstrap-variables.scss > bootstrap-variables.scss
FROM registry.docker.com/library/ruby:3.2.3-bullseye
ARG RAILS_ENV=development
ARG LIB_HOME=/srv/lib
ENV RAILS_ENV="$RAILS_ENV" \
LIB_HOME="$LIB_HOME" \
OFFLINE_CACHEDIR="$LIB_HOME/filecache" \
BUNDLE_PATH="/usr/local/bundle"
RUN mkdir -p /srv/app $OFFLINE_CACHEDIR
# Throw-away build stage to reduce size of final image
# FROM base as build
# Install packages needed to build gems
# --------------------------------------------------------------------------
# Oracle shit copied from
# https://github.com/chumaky/docker-images/blob/master/postgres_oracle.docker
# Oracle connector is needed for ISA courses and for changing usual name
# ARG ORACLE_CLIENT_URL=https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip
# ARG ORACLE_SQLPLUS_URL=https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linuxx64.zip
# ARG ORACLE_SDK_URL=https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip
# ENV ORACLE_HOME=/usr/lib/oracle/client
# WORKDIR /tmp
# RUN apt-get update; \
# apt-get install -y --no-install-recommends ca-certificates wget unzip; \
# # instant client
# wget -O instant_client.zip ${ORACLE_CLIENT_URL}; \
# unzip instant_client.zip; \
# # sqlplus
# wget -O sqlplus.zip ${ORACLE_SQLPLUS_URL}; \
# unzip sqlplus.zip; \
# # sdk
# wget -O sdk.zip ${ORACLE_SDK_URL}; \
# unzip sdk.zip; \
# # install
# mkdir -p ${ORACLE_HOME}; \
# mv instantclient*/* ${ORACLE_HOME}; \
# rm -r instantclient*; \
# rm instant_client.zip sqlplus.zip sdk.zip; \
# # required runtime libs: libaio
# apt-get install -y --no-install-recommends libaio1; \
# apt-get purge -y --auto-remove
# --------------------------------------------------------------------------
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
git \
mariadb-client \
curl \
libvips \
pkg-config \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Install application gems
WORKDIR /rails
# Note that Gemfile.lock does not need to exist
COPY Gemfile ./
COPY Gemfile.lock.docker ./Gemfile.lock
RUN gem update --system 3.5.11 && bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
# Dev only
RUN gem install foreman
WORKDIR /srv/app
COPY . .
# COPY --from=elements /elements/dist/css/elements.css /elements/dist/css/vendors.css /elements/bootstrap-variables.scss /srv/app/app/assets/stylesheets/elements/
# move this to docker entry point so that all env vars are defined
# RUN ./bin/rails dartsass:build
# Precompile bootsnap code for faster boot times
# RUN bundle exec bootsnap precompile app/ lib/
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
# RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
# Entrypoint prepares the database.
ENTRYPOINT ["/bin/bash", "/srv/app/bin/docker-entrypoint"]
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/dev"]