-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (39 loc) · 1.48 KB
/
Dockerfile
File metadata and controls
56 lines (39 loc) · 1.48 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
46
47
48
49
50
51
52
53
54
55
56
# syntax=docker/dockerfile:1
FROM ruby:3.2-slim AS build
ENV BUNDLE_DEPLOYMENT=1 \
BUNDLE_WITHOUT="development test" \
RAILS_ENV=production \
RACK_ENV=production
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends build-essential libpq-dev libyaml-dev git curl ca-certificates tzdata \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle lock --add-platform x86_64-linux && \
bundle config set --local deployment 'true' && \
bundle config set --local without 'development test' && \
bundle install --jobs=4 --retry=3
COPY . .
RUN SECRET_KEY_BASE=dummy bundle exec rake assets:precompile
FROM ruby:3.2-slim AS app
ENV RAILS_ENV=production \
RACK_ENV=production \
RAILS_LOG_TO_STDOUT=1 \
RAILS_SERVE_STATIC_FILES=1 \
PORT=80
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends libpq5 libyaml-0-2 curl wget ca-certificates tzdata \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /app /app
RUN groupadd --system --gid 1000 rails && \
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
mkdir -p log storage tmp tmp/pids tmp/sockets db && \
chown -R rails:rails log storage tmp db
COPY bin/docker-entrypoint /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
USER 1000:1000
EXPOSE 80
ENTRYPOINT ["docker-entrypoint"]
CMD ["./bin/thrust", "./bin/rails", "server"]