forked from DMPRoadmap/roadmap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
53 lines (50 loc) · 1.83 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
FROM ruby:3.3.6-slim AS base
WORKDIR /app
RUN apt update -y && apt install -y \
build-essential \
ca-certificates \
curl \
gnupg \
wget \
libpq-dev \
wkhtmltopdf \
imagemagick \
tzdata \
gnupg2 && \
wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt update -y && apt install -y yarn && \
apt clean && \
rm -rf /var/lib/apt/lists/* && \
ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime && \
ln -sf /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf && \
chmod +x /usr/local/bin/wkhtmltopdf
FROM base AS dev
COPY . .
ARG NODE_MAJOR=22
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt update -y && apt install -y \
git \
nodejs && \
bundle config set --local without 'mysql' && \
bundle install && \
yarn install && yarn --cwd app/javascript/dmp_opidor_react install
FROM dev AS production-builder
ARG DB_ADAPTER \
DB_USERNAME \
DB_PASSWORD
RUN bin/docker ${DB_ADAPTER:-postgres} && \
RAILS_ENV=build DISABLE_SPRING=1 NODE_OPTIONS=--openssl-legacy-provider rails assets:precompile && \
rm -rf node_modules && \
bundle config set --local without 'mysql thin test ci aws development build' && \
bundle install
FROM base AS production
COPY . .
COPY --from=production-builder /app/public ./public
COPY --from=production-builder /app/config ./config
COPY --from=production-builder /usr/local/bundle /usr/local/bundle
EXPOSE 3000
RUN chmod a+x /app/bin/run
CMD [ "/app/bin/run" ]