From 97474acbae2e66aa68ba37f4dfbc56351165f277 Mon Sep 17 00:00:00 2001 From: Jan Makara Date: Thu, 15 Aug 2024 19:34:55 +0200 Subject: [PATCH 1/4] add node:22.6.0 and yarn:1.22.22 to dockerfiles --- Dockerfile | 13 +++++++++++++ Dockerfile.unix | 15 +++++++++++++++ src/rails_new.rs | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2e36541..25c11f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,18 @@ ARG RUBY_VERSION=3.3.4 FROM ruby:${RUBY_VERSION} + +ARG NODE_VERSION=v22.6.0 +ARG YARN_VERSION=1.22.22 + +RUN curl -fsSL https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz \ + -o /tmp/node-$NODE_VERSION-linux-x64.tar.gz \ + && tar -xzvf /tmp/node-$NODE_VERSION-linux-x64.tar.gz -C /usr/local \ + && rm -rf /tmp/node-$NODE_VERSION-linux-x64.tar.gz + +ENV PATH=/usr/local/node-$NODE_VERSION-linux-x64/bin:$PATH + +RUN npm install -g yarn@$YARN_VERSION + ARG RAILS_VERSION # Install Rails based on the version specified but if not specified, install the latest version. RUN if [ -z "$RAILS_VERSION" ] ; then gem install rails ; else gem install rails -v $RAILS_VERSION ; fi diff --git a/Dockerfile.unix b/Dockerfile.unix index 8a66687..36335ba 100644 --- a/Dockerfile.unix +++ b/Dockerfile.unix @@ -1,9 +1,24 @@ ARG RUBY_VERSION=3.3.4 FROM ruby:${RUBY_VERSION} + ARG USER_ID=1000 ARG GROUP_ID=1000 RUN groupadd -g $GROUP_ID app && useradd -u $USER_ID -g app -m app + +ARG NODE_VERSION=v22.6.0 +ARG YARN_VERSION=1.22.22 + +RUN curl -fsSL https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz \ + -o /tmp/node-$NODE_VERSION-linux-x64.tar.gz \ + && tar -xzvf /tmp/node-$NODE_VERSION-linux-x64.tar.gz -C /usr/local \ + && rm -rf /tmp/node-$NODE_VERSION-linux-x64.tar.gz + +ENV PATH=/usr/local/node-$NODE_VERSION-linux-x64/bin:$PATH + +RUN npm install -g yarn@$YARN_VERSION + USER app + ARG RAILS_VERSION # Install Rails based on the version specified but if not specified, install the latest version. RUN if [ -z "$RAILS_VERSION" ] ; then gem install rails ; else gem install rails -v $RAILS_VERSION ; fi diff --git a/src/rails_new.rs b/src/rails_new.rs index 19d3fa0..e61b4ad 100644 --- a/src/rails_new.rs +++ b/src/rails_new.rs @@ -17,7 +17,7 @@ pub struct Cli { #[derive(Subcommand)] pub enum Commands { - /// Prints `rails new --help` + /// Print `rails new --help` RailsHelp {}, } From 393b0034993bec368f2e867800cc7d39cd4466a9 Mon Sep 17 00:00:00 2001 From: Jan Makara Date: Mon, 26 Aug 2024 16:33:24 +0200 Subject: [PATCH 2/4] update dockerfiles to install node via apt-get --- Dockerfile | 14 +++++--------- Dockerfile.unix | 14 +++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 25c11f8..295239f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,13 @@ ARG RUBY_VERSION=3.3.4 FROM ruby:${RUBY_VERSION} -ARG NODE_VERSION=v22.6.0 +ARG NODE_VERSION=22 ARG YARN_VERSION=1.22.22 -RUN curl -fsSL https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz \ - -o /tmp/node-$NODE_VERSION-linux-x64.tar.gz \ - && tar -xzvf /tmp/node-$NODE_VERSION-linux-x64.tar.gz -C /usr/local \ - && rm -rf /tmp/node-$NODE_VERSION-linux-x64.tar.gz - -ENV PATH=/usr/local/node-$NODE_VERSION-linux-x64/bin:$PATH - -RUN npm install -g yarn@$YARN_VERSION +RUN curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ + && apt-get update \ + && apt-get install --yes --no-install-recommends nodejs \ + && npm install -g yarn@$YARN_VERSION ARG RAILS_VERSION # Install Rails based on the version specified but if not specified, install the latest version. diff --git a/Dockerfile.unix b/Dockerfile.unix index 36335ba..0c2eefa 100644 --- a/Dockerfile.unix +++ b/Dockerfile.unix @@ -5,17 +5,13 @@ ARG USER_ID=1000 ARG GROUP_ID=1000 RUN groupadd -g $GROUP_ID app && useradd -u $USER_ID -g app -m app -ARG NODE_VERSION=v22.6.0 +ARG NODE_VERSION=22 ARG YARN_VERSION=1.22.22 -RUN curl -fsSL https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.gz \ - -o /tmp/node-$NODE_VERSION-linux-x64.tar.gz \ - && tar -xzvf /tmp/node-$NODE_VERSION-linux-x64.tar.gz -C /usr/local \ - && rm -rf /tmp/node-$NODE_VERSION-linux-x64.tar.gz - -ENV PATH=/usr/local/node-$NODE_VERSION-linux-x64/bin:$PATH - -RUN npm install -g yarn@$YARN_VERSION +RUN curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \ + && apt-get update \ + && apt-get install --yes --no-install-recommends nodejs \ + && npm install -g yarn@$YARN_VERSION USER app From 87b86de28b63ee89103e1965a1759572d34d96b8 Mon Sep 17 00:00:00 2001 From: Jan Makara Date: Thu, 5 Sep 2024 01:36:05 +0200 Subject: [PATCH 3/4] bump default ruby to 3.3.5, bump default rails to 7.2.1 --- Dockerfile | 2 +- Dockerfile.unix | 2 +- src/docker_client.rs | 32 ++++++++++++++++---------------- src/rails_new.rs | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 295239f..5b0968f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG RUBY_VERSION=3.3.4 +ARG RUBY_VERSION=3.3.5 FROM ruby:${RUBY_VERSION} ARG NODE_VERSION=22 diff --git a/Dockerfile.unix b/Dockerfile.unix index 0c2eefa..095037b 100644 --- a/Dockerfile.unix +++ b/Dockerfile.unix @@ -1,4 +1,4 @@ -ARG RUBY_VERSION=3.3.4 +ARG RUBY_VERSION=3.3.5 FROM ruby:${RUBY_VERSION} ARG USER_ID=1000 diff --git a/src/docker_client.rs b/src/docker_client.rs index a458c81..57caaf6 100644 --- a/src/docker_client.rs +++ b/src/docker_client.rs @@ -90,7 +90,7 @@ mod tests { #[test] fn build_image() { - let command = DockerClient::build_image("3.2.3", "7.1.3", None, None); + let command = DockerClient::build_image("3.3.5", "7.2.1", None, None); assert_eq!(command.get_program(), "docker"); @@ -101,11 +101,11 @@ mod tests { &[ "build", "--build-arg", - "RUBY_VERSION=3.2.3", + "RUBY_VERSION=3.3.5", "--build-arg", - "RAILS_VERSION=7.1.3", + "RAILS_VERSION=7.2.1", "-t", - "rails-new-3.2.3-7.1.3", + "rails-new-3.3.5-7.2.1", "-", ] ); @@ -113,7 +113,7 @@ mod tests { #[test] fn build_image_with_user_id() { - let command = DockerClient::build_image("3.2.3", "7.1.3", Some(1000), None); + let command = DockerClient::build_image("3.3.5", "7.2.1", Some(1000), None); assert_eq!(command.get_program(), "docker"); @@ -124,13 +124,13 @@ mod tests { &[ "build", "--build-arg", - "RUBY_VERSION=3.2.3", + "RUBY_VERSION=3.3.5", "--build-arg", - "RAILS_VERSION=7.1.3", + "RAILS_VERSION=7.2.1", "--build-arg", "USER_ID=1000", "-t", - "rails-new-3.2.3-7.1.3", + "rails-new-3.3.5-7.2.1", "-", ] ); @@ -138,7 +138,7 @@ mod tests { #[test] fn build_image_with_group_id() { - let command = DockerClient::build_image("3.2.3", "7.1.3", None, Some(1000)); + let command = DockerClient::build_image("3.3.5", "7.2.1", None, Some(1000)); assert_eq!(command.get_program(), "docker"); @@ -149,13 +149,13 @@ mod tests { &[ "build", "--build-arg", - "RUBY_VERSION=3.2.3", + "RUBY_VERSION=3.3.5", "--build-arg", - "RAILS_VERSION=7.1.3", + "RAILS_VERSION=7.2.1", "--build-arg", "GROUP_ID=1000", "-t", - "rails-new-3.2.3-7.1.3", + "rails-new-3.3.5-7.2.1", "-", ] ); @@ -163,7 +163,7 @@ mod tests { #[test] fn run_image() { - let command = DockerClient::run_image("3.2.3", "7.1.3", vec!["my_app".to_string()]); + let command = DockerClient::run_image("3.3.5", "7.2.1", vec!["my_app".to_string()]); assert_eq!(command.get_program(), "docker"); @@ -182,7 +182,7 @@ mod tests { &format!("{}:{}", current_dir, current_dir), "-w", current_dir, - "rails-new-3.2.3-7.1.3", + "rails-new-3.3.5-7.2.1", "rails", "new", "my_app", @@ -192,7 +192,7 @@ mod tests { #[test] fn get_help() { - let command = DockerClient::get_help("3.2.3", "7.1.3"); + let command = DockerClient::get_help("3.3.5", "7.2.1"); assert_eq!(command.get_program(), "docker"); @@ -203,7 +203,7 @@ mod tests { &[ "run", "--rm", - "rails-new-3.2.3-7.1.3", + "rails-new-3.3.5-7.2.1", "rails", "new", "--help", diff --git a/src/rails_new.rs b/src/rails_new.rs index e61b4ad..8fb41ff 100644 --- a/src/rails_new.rs +++ b/src/rails_new.rs @@ -6,9 +6,9 @@ pub struct Cli { #[clap(trailing_var_arg = true, required = true)] /// arguments passed to `rails new` pub args: Vec, - #[clap(long, short = 'u', default_value = "3.3.4")] + #[clap(long, short = 'u', default_value = "3.3.5")] pub ruby_version: String, - #[clap(long, short = 'r', default_value = "7.2.0")] + #[clap(long, short = 'r', default_value = "7.2.1")] pub rails_version: String, #[command(subcommand)] @@ -54,8 +54,8 @@ mod tests { let ruby_version = m.get_one::("ruby_version").unwrap(); let rails_version = m.get_one::("rails_version").unwrap(); - assert_eq!(ruby_version, "3.3.4"); - assert_eq!(rails_version, "7.2.0"); + assert_eq!(ruby_version, "3.3.5"); + assert_eq!(rails_version, "7.2.1"); Ok(()) } From 6f18041222f195e08e983b4cbcdafdc22d60c4e9 Mon Sep 17 00:00:00 2001 From: Jan Makara Date: Mon, 11 Nov 2024 13:15:25 +0100 Subject: [PATCH 4/4] bump default ruby to 3.3.6, bump default rails to 8.0.0 --- Dockerfile | 2 +- Dockerfile.unix | 2 +- src/docker_client.rs | 32 ++++++++++++++++---------------- src/rails_new.rs | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5b0968f..da8c802 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG RUBY_VERSION=3.3.5 +ARG RUBY_VERSION=3.3.6 FROM ruby:${RUBY_VERSION} ARG NODE_VERSION=22 diff --git a/Dockerfile.unix b/Dockerfile.unix index 095037b..f6c99f7 100644 --- a/Dockerfile.unix +++ b/Dockerfile.unix @@ -1,4 +1,4 @@ -ARG RUBY_VERSION=3.3.5 +ARG RUBY_VERSION=3.3.6 FROM ruby:${RUBY_VERSION} ARG USER_ID=1000 diff --git a/src/docker_client.rs b/src/docker_client.rs index 57caaf6..9c1c738 100644 --- a/src/docker_client.rs +++ b/src/docker_client.rs @@ -90,7 +90,7 @@ mod tests { #[test] fn build_image() { - let command = DockerClient::build_image("3.3.5", "7.2.1", None, None); + let command = DockerClient::build_image("3.3.6", "8.0.0", None, None); assert_eq!(command.get_program(), "docker"); @@ -101,11 +101,11 @@ mod tests { &[ "build", "--build-arg", - "RUBY_VERSION=3.3.5", + "RUBY_VERSION=3.3.6", "--build-arg", - "RAILS_VERSION=7.2.1", + "RAILS_VERSION=8.0.0", "-t", - "rails-new-3.3.5-7.2.1", + "rails-new-3.3.6-8.0.0", "-", ] ); @@ -113,7 +113,7 @@ mod tests { #[test] fn build_image_with_user_id() { - let command = DockerClient::build_image("3.3.5", "7.2.1", Some(1000), None); + let command = DockerClient::build_image("3.3.6", "8.0.0", Some(1000), None); assert_eq!(command.get_program(), "docker"); @@ -124,13 +124,13 @@ mod tests { &[ "build", "--build-arg", - "RUBY_VERSION=3.3.5", + "RUBY_VERSION=3.3.6", "--build-arg", - "RAILS_VERSION=7.2.1", + "RAILS_VERSION=8.0.0", "--build-arg", "USER_ID=1000", "-t", - "rails-new-3.3.5-7.2.1", + "rails-new-3.3.6-8.0.0", "-", ] ); @@ -138,7 +138,7 @@ mod tests { #[test] fn build_image_with_group_id() { - let command = DockerClient::build_image("3.3.5", "7.2.1", None, Some(1000)); + let command = DockerClient::build_image("3.3.6", "8.0.0", None, Some(1000)); assert_eq!(command.get_program(), "docker"); @@ -149,13 +149,13 @@ mod tests { &[ "build", "--build-arg", - "RUBY_VERSION=3.3.5", + "RUBY_VERSION=3.3.6", "--build-arg", - "RAILS_VERSION=7.2.1", + "RAILS_VERSION=8.0.0", "--build-arg", "GROUP_ID=1000", "-t", - "rails-new-3.3.5-7.2.1", + "rails-new-3.3.6-8.0.0", "-", ] ); @@ -163,7 +163,7 @@ mod tests { #[test] fn run_image() { - let command = DockerClient::run_image("3.3.5", "7.2.1", vec!["my_app".to_string()]); + let command = DockerClient::run_image("3.3.6", "8.0.0", vec!["my_app".to_string()]); assert_eq!(command.get_program(), "docker"); @@ -182,7 +182,7 @@ mod tests { &format!("{}:{}", current_dir, current_dir), "-w", current_dir, - "rails-new-3.3.5-7.2.1", + "rails-new-3.3.6-8.0.0", "rails", "new", "my_app", @@ -192,7 +192,7 @@ mod tests { #[test] fn get_help() { - let command = DockerClient::get_help("3.3.5", "7.2.1"); + let command = DockerClient::get_help("3.3.6", "8.0.0"); assert_eq!(command.get_program(), "docker"); @@ -203,7 +203,7 @@ mod tests { &[ "run", "--rm", - "rails-new-3.3.5-7.2.1", + "rails-new-3.3.6-8.0.0", "rails", "new", "--help", diff --git a/src/rails_new.rs b/src/rails_new.rs index 8fb41ff..570a8d4 100644 --- a/src/rails_new.rs +++ b/src/rails_new.rs @@ -6,9 +6,9 @@ pub struct Cli { #[clap(trailing_var_arg = true, required = true)] /// arguments passed to `rails new` pub args: Vec, - #[clap(long, short = 'u', default_value = "3.3.5")] + #[clap(long, short = 'u', default_value = "3.3.6")] pub ruby_version: String, - #[clap(long, short = 'r', default_value = "7.2.1")] + #[clap(long, short = 'r', default_value = "8.0.0")] pub rails_version: String, #[command(subcommand)] @@ -54,8 +54,8 @@ mod tests { let ruby_version = m.get_one::("ruby_version").unwrap(); let rails_version = m.get_one::("rails_version").unwrap(); - assert_eq!(ruby_version, "3.3.5"); - assert_eq!(rails_version, "7.2.1"); + assert_eq!(ruby_version, "3.3.6"); + assert_eq!(rails_version, "8.0.0"); Ok(()) }