-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.dev
57 lines (41 loc) · 1.49 KB
/
Dockerfile.dev
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
ARG RUBY_VERSION=3.3.0
FROM ruby:$RUBY_VERSION-slim AS base
RUN apt-get update -qq \
&& apt-get install --no-install-recommends -y build-essential ca-certificates curl gnupg locales libvips libpq-dev \
libwebp-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
WORKDIR /rails
# Install Node and Yarn JS package manager
# See also https://github.com/nodesource/distributions#installation-instructions
ARG NODE_MAJOR=20
ARG YARN_VERSION=1.22.19
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-get update && \
apt-get install nodejs -y && \
npm install -g yarn@$YARN_VERSION
# Install JS dependencies
FROM base AS node
COPY package.json yarn.lock ./
RUN yarn install
# Install Ruby dependencies
FROM base AS gems
COPY Gemfile Gemfile.lock ./
RUN gem install bundler && bundle install --jobs 20 --retry 5
# Final build
FROM base AS build
WORKDIR /rails
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
COPY . ./
# Copy ruby and JS dependencies
COPY --from=gems /usr/local/bundle /usr/local/bundle
COPY --from=node /rails/node_modules /rails/node_modules
EXPOSE 3000
ENV RUBY_YJIT_ENABLE="1"
CMD ["bin/dev"]