-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (54 loc) · 1.57 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
#
# Builder image
#
FROM ruby:3.3.4 as builder
# Directories paths as environment variables
ENV APP_HOME=/app
ENV VENDOR_ENV=/app/vendor
# Working directory
WORKDIR $APP_HOME
RUN mkdir $VENDOR_ENV
RUN mkdir $APP_HOME/.bundle
# Copy Gemfile and Gemfile.lock to the working directory
COPY Gemfile Gemfile.lock $APP_HOME/
# Copy .bundle/config to the working directory
COPY .bundle/config $APP_HOME/.bundle
# Install bundler
RUN gem install bundler
# Install dependencies
RUN bundle install
#
# Production image
#
FROM ruby:3.3.4-slim as production
# Install dependencies - imagemagick
RUN apt-get update && \
apt-get install -y --no-install-recommends imagemagick
# Directories paths as environment variables
ENV APP_HOME=/app
ENV VENDOR_ENV=/app/vendor
# Working directory
WORKDIR $APP_HOME
RUN mkdir $VENDOR_ENV
RUN mkdir $APP_HOME/.bundle
# Install bundler
RUN gem install bundler
# Copy sources from builder image
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
# Use a non-root user
RUN useradd -m cli && \
chown cli:cli $VENDOR_ENV
USER cli
# Copy sources from builder image
COPY --from=builder --chown=cli:cli $APP_HOME/Gemfile $APP_HOME/
COPY --from=builder --chown=cli:cli $APP_HOME/Gemfile.lock $APP_HOME/
COPY --from=builder --chown=cli:cli $VENDOR_ENV $VENDOR_ENV
COPY --from=builder --chown=cli:cli $APP_HOME/.bundle $APP_HOME/.bundle
# Disable Fastlane telemetry
ENV FASTLANE_OPT_OUT_USAGE=1
# Install depencies
RUN bundle install
# Download devices frames
RUN bundle exec fastlane frameit download_frames
# Entrypoint
ENTRYPOINT ["bundle", "exec", "fastlane"]