|
1 |
| -FROM rust:1.83.0-slim-bullseye |
| 1 | +# Stage 1: Build watchexec with Rust |
| 2 | +FROM rust:1.83.0-slim-bullseye AS rust-builder |
2 | 3 |
|
| 4 | +# Install necessary dependencies for Rust |
3 | 5 | RUN apt-get update -qq && \
|
4 |
| - apt-get install --no-install-recommends -y build-essential git ruby ruby-dev |
| 6 | + apt-get install --no-install-recommends -y build-essential git |
5 | 7 |
|
| 8 | +# Install watchexec |
6 | 9 | RUN cargo install watchexec-cli
|
| 10 | + |
| 11 | +# Verify installation |
| 12 | +RUN watchexec --version |
| 13 | + |
| 14 | +# Stage 2: Ruby application setup |
| 15 | +FROM ruby:2.7-slim-bullseye |
| 16 | + |
| 17 | +# Install necessary dependencies |
| 18 | +RUN apt-get update -qq && \ |
| 19 | + apt-get install --no-install-recommends -y build-essential git && \ |
| 20 | + apt-get clean && rm -rf /var/lib/apt/lists/* |
| 21 | + |
| 22 | +# Copy watchexec from the Rust stage |
| 23 | +COPY --from=rust-builder /usr/local/cargo/bin/watchexec /usr/local/bin/watchexec |
| 24 | + |
| 25 | +# Verify watchexec installation in the final image |
7 | 26 | RUN watchexec --version
|
8 | 27 |
|
9 | 28 | # throw errors if Gemfile has been modified since Gemfile.lock
|
10 |
| -RUN gem install bundler |
11 | 29 | RUN bundle config --global frozen 1
|
12 | 30 |
|
13 | 31 | WORKDIR /usr/src/app
|
14 | 32 |
|
15 | 33 | ENV LANG C.UTF-8
|
16 | 34 | ENV BUNDLER_VERSION 2.1
|
17 |
| - |
18 | 35 | ENV GEM_HOME="/usr/local/bundle"
|
19 | 36 | ENV PATH $GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH
|
20 | 37 |
|
21 | 38 | COPY Gemfile Gemfile.lock retest.gem ./
|
22 |
| - |
| 39 | +RUN gem update --system 3.2.3 |
| 40 | +RUN gem install bundler -v 2.1.4 |
23 | 41 | RUN bundle config --delete frozen
|
24 | 42 | RUN bundle install
|
25 | 43 | RUN gem install retest.gem
|
|
0 commit comments