Skip to content
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
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM rust:1-bullseye AS builder

ARG FEATURES=""
ARG APT_OPTIONAL="git"

WORKDIR /app
COPY . .
RUN cargo build --release \
RUN cargo build --release $FEATURES \
&& mkdir -p /opt/gixor/boilerplates \
&& git clone https://github.com/github/gitignore.git /opt/gixor/boilerplates/default \
&& echo '{ \n\
"base-path": "boilerplates",\n\
"base-path": "/opt/gixor/boilerplates",\n\
"repositories": [\n\
{\n\
"url": "https://github.com/github/gitignore.git",\n\
Expand All @@ -28,9 +31,16 @@ LABEL org.opencontainers.image.source=https://github.com/tamada/gixor \
org.opencontainers.image.description="Git Ignore Managenemnt System for Multiple Repositories."

Copilot AI Jan 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error: "Managenemnt" should be "Management".

Suggested change
org.opencontainers.image.description="Git Ignore Managenemnt System for Multiple Repositories."
org.opencontainers.image.description="Git Ignore Management System for Multiple Repositories."

Copilot uses AI. Check for mistakes.

RUN adduser --disabled-password --disabled-login --home /opt/gixor nonroot \
&& mkdir -p /app /opt/gixor/boilerplates
&& mkdir -p /app /opt/gixor/boilerplates \
&& apt-get update \
&& apt-get install --no-install-recommends -y $APT_OPTIONAL ca-certificates \

Copilot AI Jan 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ARG APT_OPTIONAL is defined in the builder stage but is used here in the runtime stage. In Docker, ARG values don't carry over between stages unless redeclared. Add "ARG APT_OPTIONAL" in the runtime stage (after line 26 or before line 33) to make the build argument available in this stage.

Copilot uses AI. Check for mistakes.
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /app/target/release/gixor-cli /opt/gixor/gixor
COPY --from=builder /opt/gixor /opt/gixor
COPY --from=builder /opt/gixor /opt/gixor

RUN chown -R nonroot:nonroot /opt/gixor

USER nonroot

Expand Down
32 changes: 26 additions & 6 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ clone_tamada_ignores:

clone_for_test: clone_default_ignores clone_tamada_ignores

# Generate the completion files
gen_complete:

cargo run -- --generate-completion-files

prepare_site_build:
test -d docs/public || git worktree add -f docs/public gh-pages
Expand All @@ -64,10 +65,29 @@ start:
stop:
docker stop gixorwww

# Build the docker image for gixor
docker:
docker build -t ghcr.io/tamada/gixor:latest -t ghcr.io/tamada/gixor:{{VERSION}} .
# Build the docker images of gixor with different features
docker: _docker_build_default_feature _docker_build_uselibgit_feature _docker_build_usegix_feature

_docker_build_default_feature: (_docker_build "" "git" "")
_docker_build_uselibgit_feature: (_docker_build "--features uselibgit" "" "-libgit")
_docker_build_usegix_feature: (_docker_build "--features usegix" "" "-gix")

_docker_build features apt_optional docker_tag_suffix:
docker build \
--build-arg APT_OPTIONAL="{{apt_optional}}" \
--build-arg FEATURES="{{features}}" \
-t ghcr.io/tamada/gixor:{{VERSION}}{{docker_tag_suffix}} .

# Build the docker image for multiple platforms and push them into ghcr.io
docker_buildx:
docker buildx build --platform linux/arm64/v8,linux/amd64 --output=type=image,push=true -t ghcr.io/tamada/gixor:latest -t ghcr.io/tamada/gixor:{{VERSION}} .
docker_buildx: _docker_buildx_default_feature _docker_buildx_uselibgit_feature _docker_buildx_usegix_feature

_docker_buildx_default_feature: (_docker_buildx "" "git" "")
_docker_buildx_uselibgit_feature: (_docker_buildx "--features uselibgit" "" "-libgit")
_docker_buildx_usegix_feature: (_docker_buildx "--features usegix" "" "-gix")

_docker_buildx features apt_optional docker_tag_suffix:
docker buildx build --platform linux/arm64/v8,linux/amd64 \
--output=type=image,push=true \
--build-arg APT_OPTIONAL="{{apt_optional}}" \
--build-arg FEATURES="{{features}}" \
-t ghcr.io/tamada/gixor:{{VERSION}}{{docker_tag_suffix}} .
3 changes: 2 additions & 1 deletion lib/src/gitbridge/git2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ fn normal_merge(
}

pub fn hash<P: AsRef<Path>>(boilerplate: &Boilerplate, base_path: P) -> crate::Result<Vec<u8>> {
let repo_path = boilerplate.repo_path(base_path.as_ref());
let path = boilerplate.file_path(base_path);
log::trace!("try to open the git repository: {}", path.display());
let gitrepo = match git2::Repository::open(&path) {
let gitrepo = match git2::Repository::open(&repo_path) {
Ok(repo) => Ok(repo),
Err(_) => {
let message = format!("{}: Failed to open the repository", path.display());
Expand Down
2 changes: 2 additions & 0 deletions lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ impl GixorFactory {

impl Gixor {
fn new(config: Config, load_from: PathBuf) -> Self {
log::debug!("config path: {load_from:?}");
log::debug!("config: {}", serde_json::to_string_pretty(&config).unwrap());

Copilot AI Jan 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using unwrap() in a logging statement can cause a panic if the config fails to serialize to JSON (e.g., if it contains non-serializable data). Consider using unwrap_or_else() or unwrap_or() to provide a fallback message instead of panicking during logging.

Suggested change
log::debug!("config: {}", serde_json::to_string_pretty(&config).unwrap());
log::debug!(
"config: {}",
serde_json::to_string_pretty(&config)
.unwrap_or_else(|e| format!("(failed to serialize config: {e})"))
);

Copilot uses AI. Check for mistakes.
Gixor { config, load_from }
}
/// Returns the base path of this configuration.
Expand Down
Loading