-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 1.12 KB
/
Dockerfile
File metadata and controls
45 lines (32 loc) · 1.12 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
# syntax=docker/dockerfile:1
ARG RUBY_VERSION=3.4
FROM ruby:${RUBY_VERSION} AS base
ENV BUNDLE_WITHOUT="development:test" \
RAILS_ENV=production \
NODE_ENV=production \
NPM_CONFIG_PRODUCTION=false
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends build-essential libpq-dev git curl nodejs npm && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle install --jobs=4 --retry=3
COPY . .
# Install JS deps including devDependencies for the PostCSS build, then build CSS.
RUN npm ci --production=false && \
npm run build:css
RUN SECRET_KEY_BASE=dummy bundle exec rails assets:precompile
FROM ruby:${RUBY_VERSION}-slim AS final
ENV BUNDLE_WITHOUT="development:test" \
RAILS_ENV=production \
RAILS_LOG_TO_STDOUT=1 \
RAILS_SERVE_STATIC_FILES=1 \
NODE_ENV=production
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends libpq5 curl && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=base /usr/local/bundle /usr/local/bundle
COPY --from=base /app /app
EXPOSE 3000
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]