Skip to content

Commit 2919aaf

Browse files
committed
Do not create an used and group on macos
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.
1 parent 7c9e26d commit 2919aaf

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
ARG RUBY_VERSION=3.2.3
22
FROM ruby:${RUBY_VERSION}
3-
ARG USER_ID=1000
4-
ARG GROUP_ID=1000
5-
RUN groupadd -g $GROUP_ID app && useradd -u $USER_ID -g app -m app
6-
USER app
73
ARG RAILS_VERSION
84
# Install Rails based on the version specified but if not specified, install the latest version.
95
RUN if [ -z "$RAILS_VERSION" ] ; then gem install rails ; else gem install rails -v $RAILS_VERSION ; fi
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
ARG RUBY_VERSION=3.2.3
22
FROM ruby:${RUBY_VERSION}
3+
ARG USER_ID=1000
4+
ARG GROUP_ID=1000
5+
RUN groupadd -g $GROUP_ID app && useradd -u $USER_ID -g app -m app
6+
USER app
37
ARG RAILS_VERSION
48
# Install Rails based on the version specified but if not specified, install the latest version.
59
RUN if [ -z "$RAILS_VERSION" ] ; then gem install rails ; else gem install rails -v $RAILS_VERSION ; fi

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use clap::Parser;
1010

1111
use crate::docker_client::DockerClient;
1212

13-
#[cfg_attr(unix, path = "unix.rs")]
14-
#[cfg_attr(windows, path = "windows.rs")]
13+
#[cfg_attr(all(unix, not(target_os = "macos")), path = "unix.rs")]
14+
#[cfg_attr(any(windows, target_os = "macos"), path = "windows.rs")]
1515
mod os_specific;
1616

1717
fn main() {

src/unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub fn dockerfile_content() -> &'static [u8] {
2-
include_bytes!("../Dockerfile")
2+
include_bytes!("../Dockerfile.unix")
33
}
44

55
pub fn get_user_id() -> Option<u32> {

src/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub fn dockerfile_content() -> &'static [u8] {
2-
include_bytes!("../Dockerfile.windows")
2+
include_bytes!("../Dockerfile")
33
}
44

55
pub fn get_user_id() -> Option<u32> {

0 commit comments

Comments
 (0)