Skip to content

change default of --link to false #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ different contents. If both are specified, `--force` takes precedence.
* `--max-idle=n` - exit afer *n* seconds of inactivity. Supports [iso 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) and [sleep](https://man7.org/linux/man-pages/man1/sleep.1.html#DESCRIPTION) syntaxes. Uses passenger for now, awaiting [puma](https://github.com/puma/puma/issues/2580) support.
* `--nginx` - serve static files via [nginx](https://www.nginx.com/). May require `--root` on some targets to access `/dev/stdout`
* `--thruster` - serve static files via [thruster](https://github.com/basecamp/thruster?tab=readme-ov-file#thruster).
* `--no-link` - don't add [--link](https://docs.docker.com/engine/reference/builder/#copy---link) to COPY statements. Some tools (like at the moment, [buildah](https://www.redhat.com/en/topics/containers/what-is-buildah)) don't yet support this feature.
* `--link` - add [--link](https://docs.docker.com/engine/reference/builder/#copy---link) to COPY statements. Some tools (like at the moment, [buildah](https://www.redhat.com/en/topics/containers/what-is-buildah)) don't yet support this feature.
* `--no-lock` - don't add linux platforms, set `BUNDLE_DEPLOY`, or `--frozen-lockfile`. May be needed at times to work around a [rubygems bug](https://github.com/rubygems/rubygems/issues/6082#issuecomment-1329756343).
* `--sudo` - install and configure sudo to enable `sudo -iu rails` access to full environment

Expand Down
4 changes: 2 additions & 2 deletions lib/generators/dockerfile_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DockerfileGenerator < Rails::Generators::Base
"gemfile-updates" => true,
"jemalloc" => false,
"label" => {},
"link" => true,
"link" => false,
"litefs" => false,
"lock" => true,
"max-idle" => nil,
Expand Down Expand Up @@ -117,7 +117,7 @@ class DockerfileGenerator < Rails::Generators::Base
class_option :ci, type: :boolean, default: OPTION_DEFAULTS.ci,
desc: "include test gems in bundle"

class_option :link, type: :boolean, default: OPTION_DEFAULTS.lock,
class_option :link, type: :boolean, default: OPTION_DEFAULTS.link,
desc: "use COPY --link whenever possible"

class_option :lock, type: :boolean, default: OPTION_DEFAULTS.lock,
Expand Down
6 changes: 3 additions & 3 deletions test/results/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ RUN curl -sL https://unofficial-builds.nodejs.org/download/release/v${NODE_VERSI
rm -rf /tmp/node-v${NODE_VERSION}-linux-x64-musl

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Install node modules
COPY --link package.json yarn.lock ./
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# Copy application code
COPY --link . .
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
Expand Down
8 changes: 4 additions & 4 deletions test/results/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ WORKDIR /rails/my-app
ENV NODE_ENV=production

# Install node modules
COPY --link my-app/package.json ./
COPY my-app/package.json ./
RUN npm install

# build client application
COPY --link my-app .
COPY my-app .
RUN npm run build


Expand Down Expand Up @@ -43,13 +43,13 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
Expand Down
4 changes: 2 additions & 2 deletions test/results/bin_cd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Adjust binfiles to set current working directory
RUN grep -l '#!/usr/bin/env ruby' /rails/bin/* | xargs sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)'
Expand Down
6 changes: 3 additions & 3 deletions test/results/bun/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ ENV PATH=/usr/local/bun/bin:$PATH
RUN curl -fsSL https://bun.sh/install | bash -s -- "bun-v${BUN_VERSION}"

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Install node modules
COPY --link package.json bun.lockb ./
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile

# Copy application code
COPY --link . .
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
Expand Down
6 changes: 3 additions & 3 deletions test/results/cache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
rm -rf /tmp/node-build-master

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN --mount=type=cache,id=bld-gem-cache,sharing=locked,target=/srv/vendor \
bundle config set app_config .bundle && \
bundle config set path /srv/vendor && \
Expand All @@ -49,12 +49,12 @@ RUN --mount=type=cache,id=bld-gem-cache,sharing=locked,target=/srv/vendor \
cp -ar /srv/vendor .

# Install node modules
COPY --link package.json yarn.lock ./
COPY package.json yarn.lock ./
RUN --mount=type=cache,id=bld-yarn-cache,target=/root/.yarn \
YARN_CACHE_FOLDER=/root/.yarn yarn install --frozen-lockfile

# Copy application code
COPY --link . .
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
Expand Down
4 changes: 2 additions & 2 deletions test/results/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
4 changes: 2 additions & 2 deletions test/results/config/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config

# Install application gems
COPY Gemfile Gemfile.lock ./
COPY --link Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY . .
COPY --link . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
4 changes: 2 additions & 2 deletions test/results/env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ ENV AWS_ACCESS_KEY_ID="1" \
AWS_SECRET_ACCESS_KEY="1"

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
6 changes: 3 additions & 3 deletions test/results/esbuild/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
rm -rf /tmp/node-build-master

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Install node modules
COPY --link package.json yarn.lock ./
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# Copy application code
COPY --link . .
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
Expand Down
4 changes: 2 additions & 2 deletions test/results/execjs_importmap/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ RUN apt-get update -qq && \
ENV PATH="/usr/local/node/bin:$PATH"

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
Expand Down
6 changes: 3 additions & 3 deletions test/results/execjs_node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ RUN npm install -g yarn@$YARN_VERSION
ENV PATH="/usr/local/node/bin:$PATH"

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Install node modules
COPY --link package.json yarn.lock ./
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# Copy application code
COPY --link . .
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
Expand Down
4 changes: 2 additions & 2 deletions test/results/fullstaq/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential libyaml-dev pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
6 changes: 3 additions & 3 deletions test/results/grover/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ ENV PATH="/usr/local/node/bin:$PATH" \
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Install node modules
COPY --link package.json package-lock.json ./
COPY package.json package-lock.json ./
RUN npm install

# Copy application code
COPY --link . .
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
4 changes: 2 additions & 2 deletions test/results/idle/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Compile passenger native support
RUN passenger-config build-native-support

# Copy application code
COPY --link . .
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
4 changes: 2 additions & 2 deletions test/results/jemalloc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
4 changes: 2 additions & 2 deletions test/results/label/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
6 changes: 3 additions & 3 deletions test/results/litefs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
Expand All @@ -46,7 +46,7 @@ FROM base

# Install, configure litefs
COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs /usr/local/bin/litefs
COPY --link config/litefs.yml /etc/litefs.yml
COPY config/litefs.yml /etc/litefs.yml

# Install packages needed for deployment
RUN apt-get update -qq && \
Expand Down
4 changes: 2 additions & 2 deletions test/results/minimal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
4 changes: 2 additions & 2 deletions test/results/mysql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
Expand Down
4 changes: 2 additions & 2 deletions test/results/nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential pkg-config

# Install application gems
COPY --link Gemfile Gemfile.lock ./
COPY Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git

# Copy application code
COPY --link . .
COPY . .

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
Expand Down
Loading
Loading