Skip to content

Commit

Permalink
Do not create an used and group on macos
Browse files Browse the repository at this point in the history
Docker desktop for macos already set the right user and group for the
generated files.

Trying to create an group conflicts with an already existing group
inside the container and the generation was failing.

Closes #12.
  • Loading branch information
rafaelfranca committed Apr 11, 2024
1 parent 7c9e26d commit 2919aaf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
ARG RUBY_VERSION=3.2.3
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
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
4 changes: 4 additions & 0 deletions Dockerfile.windows → Dockerfile.unix
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
ARG RUBY_VERSION=3.2.3
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
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
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use clap::Parser;

use crate::docker_client::DockerClient;

#[cfg_attr(unix, path = "unix.rs")]
#[cfg_attr(windows, path = "windows.rs")]
#[cfg_attr(all(unix, not(target_os = "macos")), path = "unix.rs")]
#[cfg_attr(any(windows, target_os = "macos"), path = "windows.rs")]
mod os_specific;

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/unix.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub fn dockerfile_content() -> &'static [u8] {
include_bytes!("../Dockerfile")
include_bytes!("../Dockerfile.unix")
}

pub fn get_user_id() -> Option<u32> {
Expand Down
2 changes: 1 addition & 1 deletion src/windows.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub fn dockerfile_content() -> &'static [u8] {
include_bytes!("../Dockerfile.windows")
include_bytes!("../Dockerfile")
}

pub fn get_user_id() -> Option<u32> {
Expand Down

0 comments on commit 2919aaf

Please sign in to comment.